how to touch and swip

Just started using Construct 2? Post your questions here

Post » Sat Dec 20, 2014 6:47 pm

Hi all my Quastion is: i want to touch and swipe tree, for example i want to touch on tree and swipe to left this tree image. when touch on tree and swipe tree to left i can set animation for that. like with Angry birds game
You do not have the required permissions to view the files attached to this post.
B
5
Posts: 11
Reputation: 247

Post » Mon Dec 22, 2014 5:27 am

Okay so...

You need to have an object that you can test for when touching. My guess is that would be the tree. Second you need an object to the left of the tree. that is invisible. Create a variable called touchdt.

When you touch the tree, set touchdt to 0

everytick add dt to touchdtt

If touch overlaps the object on the left and touchdt < some value (0.3 seconds?) then play the animation.


You could also do this by tracking touch location, adding up the change in position over x amount of time and if the change in position after touching the tree is greater than x, call it a swipe so long as the player never stopped touching the screen during the add up.
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,153

Post » Tue Dec 23, 2014 12:37 pm

try this click or touch tree and see
You do not have the required permissions to view the files attached to this post.
B
252
S
39
G
15
Posts: 1,964
Reputation: 40,753


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest