Hello guys,
Sorry to bother but I just hit what seems to be a dead end in my search for “the lost event”
Here is a quick summary of the issue:
My goal : manage the continuity of my on-screen d-pad position between scene changes
(i.e. my user can keep its thumb on it or release it whenever he wants)
My problem : touch events happening while destroying scene 1 and loading scene 2 are never received
by my ‘Runtime listener’ even if it is not removed (nor re-added).
It is especially problematic for lost ‘ended’ events as my d-pad will keep its last value and move the character
even if my user is no longer pressing the pad.
My context : I use the following state machine for my scene changes:
game.lua (params = level_1) -> loader.lua (params = level_2) -> game.lua (params = level_2)
As I need to re-call the ‘create()’ function of my scene, at each change I call:
composer.removeScene( “nextScene”, false )
composer.gotoScene(“nextScene”, …)
Regarding my listener, I use (once):
Runtime:addEventListener( “touch”, M.onTouch )
I made sure it is never removed (by me at least) and even tried to require its file/class as a global variable
from ‘main.lua’ but it doesn’t change anything. FYI, I works prefectly well before and after the scene switch.
It is just between that the events stop coming…
Note: it seems the runtime key listener (from my ‘main.lua’) keeps working while switching
I hope I gave you enough info. If not, please do not hesitate.
I suspect an issue with the ‘composer’ API itself so I will be glad to hear from you guys.
Thanks,
Go-G