Detect touch events

hi there,

is there any chance to detect at a certain point in time where a finger is touching the screen?

case: player is moving, animation running. user may press in other direction. if anim is done, player should walk in other direction without the finger to be lifted and screen to be pressed again.

thanks! [import]uid: 90610 topic_id: 17464 reply_id: 317464[/import]

maybe something like this?
[lua]local timeRR

local function check(event)
if event.phase == “began” then
timeRR = timer.performWithDelay(3000, function() print(event.phase) end, 0)
end
if event.phase == “ended” then
print(event.phase)
timer.cancel(timeRR)
end
end

Runtime:addEventListener(“touch”, check)[/lua] [import]uid: 16142 topic_id: 17464 reply_id: 66241[/import]

@digiDingo, that’s a very Aussie name… are you an Aussie?

NEWays, to your question…

If I was playing a game and the character was animating a run towards the right and I press the left button, I am not sure I would want to see the character still continuing the animation to the right, I might want that the animation stops and the move/run left animation start.

cheers,

?:slight_smile: [import]uid: 3826 topic_id: 17464 reply_id: 66245[/import]

not aussie, but loving australia…so we came up with this name :slight_smile:

I know what you mean. The game is tile based, so the player can only turn if he finished walking the tile (at least, this is how it is implemented. player is actually moving on that grid). [import]uid: 90610 topic_id: 17464 reply_id: 66252[/import]

thanks for your code mate. I solved it another way.

thanks again! [import]uid: 90610 topic_id: 17464 reply_id: 66409[/import]