Change scene by finger swipe

vinhnguyenvan08vinhnguyenvan08 Member, BASIC Posts: 1

Hi all
I want to make action: change to another scene( next or previous) when swipe finger,
Could you please teach me this technique!
Thank you very much!

Comments

  • rainwaterstudiosrainwaterstudios Member Posts: 198

    Start by adding 4 'real' attributes in the actor: touchStartX, touchStartY, touchEndX & touchEndY.
    To detect a swipe, use 'change attribute' behaviors like this:
    when touch is pressed, change touchStartX to game.Mouse.Position.X & change touchStartY to game.Mouse.Position.Y
    Next, detect when touch is released (inside the 'touch is pressed' rule) with a slight delay timer (I have .2 seconds and it seems to work well) and if touch is released, change touchEndX to game.Mouse.Position.X & change touchEndY to game.Mouse.Position.Y
    Finally, create a separate rule that detects if touchEndX > touchStartX, put a Change Scene behavior inside a slight delay timer.

Sign In or Register to comment.