GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Change scene by finger swipe

vinhnguyenvan08vinhnguyenvan08 Posts: 1Member, BASIC

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 Posts: 152Member, PRO

    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.

  • rainwaterstudiosrainwaterstudios Posts: 152Member, PRO
Sign In or Register to comment.