local physics=require(“physics”);
physics.start();
physics.setGravity(0,0);
local ball=display.newImageRect(“c.png”,200,100);
ball.x=300;
ball.y=200;
physics.addBody(ball);
local function activateball(self,event)
self:applyForce(0,-1.5,self.x,self.y)
end
local function tc(event)
if event.phase=="began"then
ball.enterFrame=activateball
Runtime:addEventListener(“enterFrame”,ball)
end
if event.phase=="ended"then
Runtime:removeEventListener(“enterFrame”,ball);
end
end
Runtime:addEventListener(“touch”,tc);
hii…i wrote this program to learn touch event .Everything is good but there is a problem in last phase of touch(ended phase).when i just tap out ,my object BALL doesnt stop at that point where i just tapped out .
and i also want to share that i have learnt this method from tutorial https://www.youtube.com/watch?v=_7kCULfpDWY