Reputation: 4941
I want TOUCHES_ENDS event to be dispatched until user touches the screen, how ever it is dispatched only once when the touch is removed, for example, I want my player to be running continuously while the user is not touching the screen and need to do something else when user touches the screen. Please?
Upvotes: 0
Views: 183
Reputation: 402
I don't know Gideros, however you could use those events to store a Lua variable that indicates the touch-state. For example, when the TOUCHES_BEGIN event is fired, set a global variable named _touching to true. When the TOUCHES_END event is fired, you could then set that global variable to false.
Assuming the code is running in a loop, you then simply have the player walk when the global _touching variable is set to false and do something else when that variable evaluates to true.
Also, after a little bit of Googling, I noticed a TOUCHES_MOVE and TOUCHES_CANCEL event as well and the END event is called TOUCHES_END (for the Sprite library), you might want to check up on those:
Hopefully this will help you on your way.
edit - Global variables are usually considered as something bad in Lua, but in this case, it would help you out a big deal.
Upvotes: 1