Construct 2 swipe Tutorial – using touch plugin we can call swipe event moving the player left and right.
launch Construct 2. Click the File button, and select New.
Set the layout width and height : 480×854
Double-click a space in the layout. This will bring up the Insert Object dialog. Double click the Sprite object to insert it.
Click on the layout to place the sprite , it will open the image editor , with rectangle tool draw a simple box
add a 8 movement behaviour to it
go to even sheet
add to 2 global variable to store position of Touch
- 1touchX = 0
- movement = 0
add condition to check the swipe movet is left to right or right to left
- on any touch start > set the variable to Touch.X
- on any touch start
subevent> if 1touchX is less than Touch.X> set movement to 1
subevent> if 1touchX is greater than Touch.X > set the movement to 2
- if movement = 1 > player move right
- if movement = 2 > Player move left