Hello all,
I am using director.lua to change scenes when options are selected from menu and that is working fine.
But now i try to include some animations for those menus.
in end of menu.lua (which is my main menu) i set up event listener
[lua]Runtime:addEventListener(“enterFrame”, menuAnimation)[/lua]
menuanimation in menu.lua
[lua]local function menuAnimation()
–>Here i will update my menu animation if possible
end[/lua]
and then i have pressPlay button event function in menu.lua
[lua]local function pressPlay (event)
if event.phase == “ended” then
–>This removeEventListener is my problem atm
Runtime:removeEventListener(“enterFrame”, menuAnimation)
director:changeScene (“game”, “moveFromRight”)
end
end[/lua]
First: Why that removeEventListener call don’t do what “i think it should do”? and where and how i need to call it so menuAnimation() calls on every frame end?
Second: Should I even do like this because I am planing to use this also how my gameloop work, or is there some better way to do it? Kind of need some information to get pushed in right direction with these game/animationloops.
[import]uid: 78572 topic_id: 13084 reply_id: 313084[/import]