The situation is : I have my first scene, I click on it and go to second scene using scene manager.
In second scene, I have some code that is to be executed only when user touches the screen, but as soon as I go to second screen, the character is already moving up and down with its initial values without me touching the screen.Please, any idea? where am I doing it wrong?
Here is the code:
function Play: init()
self: addEventListener(Event.TOUCHES_BEGIN, self.whenTouched, self)
self: addEventListener(Event.TOUCHES_END, self.whenuntouched, self)
function Play: whenTouched()
x,y = self.myAnim:getPosition()
if self.touchStarted then
speed = -16
self.touchStarted = false
y = y + speed;