local bg=display.newImageRect(“c.png”,200,100);
bg.x=100;
bg.y=150;
bg.alpha=0.6;
physics.addBody(bg,{isSensor=true});
this is my code and i am getting an error
attempt to index global ‘physics’(a nil value).
local bg=display.newImageRect(“c.png”,200,100);
bg.x=100;
bg.y=150;
bg.alpha=0.6;
physics.addBody(bg,{isSensor=true});
this is my code and i am getting an error
attempt to index global ‘physics’(a nil value).
Have you got this at the top of your code?
[lua]
local physics = require( “physics” )
[/lua]
yes i forgot to write
thanks
local physics=require(“physics”);
local bg=display.newImageRect(“c.png”,200,100);
bg.x=100;
bg.y=100;
bg.alpha=0.6;
physics.addBody(bg,{isSensor=true});
function dr(self,error)
self.alpha=self.alpha+0.2;
end
bg.enterFrame=dr;
RunTime:addEventListener(“enterFrame”,dr);
error:attempt to index global ‘runtime’(a nil value).
It’s “Runtime”, and not “RunTime”.
Have you got this at the top of your code?
[lua]
local physics = require( “physics” )
[/lua]
yes i forgot to write
thanks
local physics=require(“physics”);
local bg=display.newImageRect(“c.png”,200,100);
bg.x=100;
bg.y=100;
bg.alpha=0.6;
physics.addBody(bg,{isSensor=true});
function dr(self,error)
self.alpha=self.alpha+0.2;
end
bg.enterFrame=dr;
RunTime:addEventListener(“enterFrame”,dr);
error:attempt to index global ‘runtime’(a nil value).
It’s “Runtime”, and not “RunTime”.