How do I detect Touch Vs Swipe ?

Get help using Construct 2

Post » Tue Jul 15, 2014 5:26 pm

I have levels menu where i can swipe up/down to see all the levels and also click on the level button to goto a particular level. the swipe can happen through the button which means i need to know whether it's a touch or a touch for swipe. I try to compare the touch speed , it always gives zero for some reason. Any example is appreciated ?
B
16
S
4
Posts: 248
Reputation: 2,267

Post » Tue Jul 15, 2014 6:10 pm

Using touch > on tap for buttons and drag and drop for the scrollable area should do the job.
If you want to go deeper into it, save X or Y on any touch begin, on touch ended compare Touch X or Y - TouchBegin X or Y, if that value is greater than an offset you would should it's a swipe, otherwise it's a touch.
note: use abs() when calculating the value, so you always get a positive number.
Please tag me with @caiorosisca if your post is refering to me :). I don't always follow the topics I answer.
B
11
S
4
G
1
Posts: 272
Reputation: 1,643

Post » Tue Jul 15, 2014 7:41 pm

B
11
S
2
G
1
Posts: 202
Reputation: 1,580

Post » Thu Jul 17, 2014 10:47 pm

In the iPhone 5 comparing between Touch.X and Touch.Y on Touch start and then Touch end seems to work fine , but for iPad they are NOT equal for some reason ? How much offset can we allow so that it works seemlessly on all the devices ?
B
16
S
4
Posts: 248
Reputation: 2,267

Post » Fri Jul 18, 2014 12:31 am

I think what you ask is not possible via a command or action.

You need to solve it separately , for each case.

This may end up with 2 different projects , had similar issue and end up coding 2 different projects....
Hire or Offer a project

Portfolio

Scirra new Shop
B
34
S
5
G
1
Posts: 118
Reputation: 2,663

Post » Fri Jul 18, 2014 2:17 pm

@tringio I don't see a reason for it to work in iPhone and not in iPad, it shouldn't make any difference.
What do you mean by they are NOT equal? I'm not sure how big the offset should be, and I don't have devices to try on right now, my advice if to make the offset relative to the screensize, something like 10% of screen size.
Please tag me with @caiorosisca if your post is refering to me :). I don't always follow the topics I answer.
B
11
S
4
G
1
Posts: 272
Reputation: 1,643


Return to How do I....?

Who is online

Users browsing this forum: dop2000, namaewayukidesu, Xh3maa and 10 guests