So after getting corona yesterday I have been hard at work creating my first app. :) It was all going so well until I have come across this one problem
Basically I have a ball rolling across the screen:
function onEveryFrame(event)
enemy:applyForce( 0.1,0 )
end
Runtime:addEventListener( “enterFrame”, onEveryFrame )
This works fine and the ball rolls forever and ever which is intended.
Now the section which doesn’t seem to work comes straight afterwards
function slowDown(self,event)
self.applyForce( -100,0, self.x, self.y )
end
function touchScreen(event)
print(“Touch”)
if event.phase == “began”
then enemy.enterFrame = slowDown
Runtime:addEventListener(“enterFrame”, enemy)
end
if event.phase == “ended”
then Runtime:removeEventListener(“enterFrame”, enemy)
end
end
Runtime:removeEventListener(“enterFrame”, touchScreen)
This section is basically meant to slow the ball down on each screen click, but doesn’t do anything :(
I have tried changing the slowDown function to:
function slowDown(event)
enemy:applyForce( -100,0)
_ end _
But this still does not work so the ball does not slow down, even the print doesn’t work yet no errors and the simulator runs fine as if this section of code just doesn’t exist?
here is the whole section together
Any help appreciated greatly!!!