+1 RE appearing the event isn’t firing – just be sure to cancel that timer if you change scenes etc. [import]uid: 52491 topic_id: 33184 reply_id: 131834[/import]
Thank you sooooooo much. This has been a huge obstacle for me and now it works like a dream : )
ty ty ty ty ty ty
-Andrew [import]uid: 72845 topic_id: 33184 reply_id: 131991[/import]
One more question. So my sprite is set to go from point A to point B using a transition. When the sprite “dies” it still moves from point A to point B triggering not only game over but the Level complete also.
playbutton.active = false
local function buttonTouched(e) if e.phase == "began" then
e.target.alpha = .5
end if e.phase == "ended" then
mario:play();
trans1 = transition.to( mario, { time=15000, x = 1100 } )
e.target.alpha = 1 print("Replay button was touched.")
end
end
playbutton:addEventListener( "touch", buttonTouched )
playbutton:addEventListener('tap', playbutton)
How would I stop this transition if I trigger the Game over? [import]uid: 72845 topic_id: 33184 reply_id: 132017[/import]
I assume you have “trans1” up-referenced somewhere? If so, you can cancel any transition (that is up-value referenced) by using:
transition.cancel( trans1 )
Best of luck!
Brent
[import]uid: 9747 topic_id: 33184 reply_id: 132021[/import]
Thank you sooooooo much. This has been a huge obstacle for me and now it works like a dream : )
ty ty ty ty ty ty
-Andrew [import]uid: 72845 topic_id: 33184 reply_id: 131991[/import]
One more question. So my sprite is set to go from point A to point B using a transition. When the sprite “dies” it still moves from point A to point B triggering not only game over but the Level complete also.
playbutton.active = false
local function buttonTouched(e) if e.phase == "began" then
e.target.alpha = .5
end if e.phase == "ended" then
mario:play();
trans1 = transition.to( mario, { time=15000, x = 1100 } )
e.target.alpha = 1 print("Replay button was touched.")
end
end
playbutton:addEventListener( "touch", buttonTouched )
playbutton:addEventListener('tap', playbutton)
How would I stop this transition if I trigger the Game over? [import]uid: 72845 topic_id: 33184 reply_id: 132017[/import]
I assume you have “trans1” up-referenced somewhere? If so, you can cancel any transition (that is up-value referenced) by using:
transition.cancel( trans1 )
Best of luck!
Brent
[import]uid: 9747 topic_id: 33184 reply_id: 132021[/import]