# How do I implement mobile flick gestures?

Get help using Construct 2

### » Tue Mar 08, 2016 7:47 pm

Hi guys,

I've posted here before with great success and I've got another thing I need advice for.

I'm hoping to implement a flick mechanic where the player can flick an object to make it slide in the direction of the flick. I'd like it to travel at a speed that scales with how hard the person flicks and slides to a stop. Think of a game like curling as far as the sliding object goes.

Does anyone know of any examples or tutorials?

Thanks guys!
B
7
S
3
Posts: 42
Reputation: 658

### » Tue Mar 08, 2016 11:24 pm

Have you tried searching in the tutorials?

https://www.scirra.com/tutorials/search?q=swipe

Generally speaking you'll have a friction type value that would always be reducing the object's velocity towards 0 at a constant amount, and then its just a matter of setting the initial speed based on your swipe.

The basic logic for that is that every tick you will record the position of the object in variables, and you can compare the objects position at the current tick with the last tick when you release the object. The distance between these two points can be used to set your starting velocity.
B
61
S
30
G
134
Posts: 1,970
Reputation: 75,442

### » Wed Mar 09, 2016 12:16 am

B
179
S
50
G
207
Posts: 8,719
Reputation: 128,306

### » Wed Mar 09, 2016 10:03 am

oosyrag wrote:Have you tried searching in the tutorials?

https://www.scirra.com/tutorials/search?q=swipe

Generally speaking you'll have a friction type value that would always be reducing the object's velocity towards 0 at a constant amount, and then its just a matter of setting the initial speed based on your swipe.

The basic logic for that is that every tick you will record the position of the object in variables, and you can compare the objects position at the current tick with the last tick when you release the object. The distance between these two points can be used to set your starting velocity.

This sounds exactly like what I want to do I'm just not sure how to. I've looked through those tutorials and I've not found one that works for what I want. How do I get the initial speed based on my swipe? I'll play around with it today but if anyone has a capx or can simplify this process it would be greatly appreciated.

Thanks so far!
B
7
S
3
Posts: 42
Reputation: 658

Any suggestions?
B
7
S
3
Posts: 42
Reputation: 658

### » Wed Mar 09, 2016 6:00 pm

Check out newt's link, it should have exactly what you're looking for.
B
61
S
30
G
134
Posts: 1,970
Reputation: 75,442

### » Wed Mar 09, 2016 10:42 pm

oosyrag wrote:Check out newt's link, it should have exactly what you're looking for.

My concern is it doesn't seem to have everything I need and I'm genuinely unable to afford it right now to test it.
B
7
S
3
Posts: 42
Reputation: 658

### » Thu Mar 10, 2016 12:14 am

B
61
S
30
G
134
Posts: 1,970
Reputation: 75,442

### » Thu Mar 10, 2016 8:35 am

oosyrag wrote:https://www.dropbox.com/s/tdpov7on7qwd9pu/fling.capx?dl=0

Thank you so much! This looks like a great start point for me. I really appreciate it!
B
7
S
3
Posts: 42
Reputation: 658

### » Thu Mar 10, 2016 8:47 am

I've just thought, how would I make an object hit another and send the other object bouncing away, like balls on a pool table. Would it be something with physics?
B
7
S
3
Posts: 42
Reputation: 658

Next