Touch

Get help using Construct 2

Post » Wed May 08, 2013 5:21 pm

Was going through the tutorial for Pong and wanted to implement swipe feature on the paddle, any ideas on how to do it? Previous example and tutorials aren't really getting me to where I want.


Touch worked for me when I made a controller on screen just don't know what I'm doing wrong.
B
7
S
1
Posts: 33
Reputation: 623

Post » Wed May 08, 2013 6:15 pm

You mean where you touch the screen and slide your finger back and forth to move the paddle?
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Wed May 08, 2013 9:42 pm

Yes I would like to swipe the paddle to move up and swipe it to move down. Nothing crazy as Kyatric made the pong tutorial and I'm going through that except adding it to mobile Samsung Galaxy Note 8 :)
B
7
S
1
Posts: 33
Reputation: 623

Post » Wed May 08, 2013 9:56 pm

Oh ok, so you don't want the paddle locked into the x or y coordinate of the the touch, you just want it to move up or down when you swipe.

Have you looked into the On Any Touch Start and on Any Touch End events? You could calculate the start and stop of the swipe and determine which way the user swiped.

Make sense?
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Wed May 08, 2013 10:50 pm

Yes got any ideas how to set that up?
B
7
S
1
Posts: 33
Reputation: 623

Post » Wed May 08, 2013 10:59 pm

Sure, if you calculating a swipe up and down (y axis) setup 2 global variables. StartTouch and EndTouch

On Touch Start set StartTouch to touch.y
On Touch End set EndTouch to touch.y

If StartTouch > EndTouch then
The user swiped up
Else
The User Swiped down

Let me know if that makes sense.
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Thu May 09, 2013 1:39 am

Well I'm not much of a programmer but any help I can get I'll give it a try, will let you know thank you.
B
7
S
1
Posts: 33
Reputation: 623

Post » Thu May 09, 2013 1:59 am

I can make up a sample capx later tonight if you can't get it.
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Thu May 09, 2013 3:09 am

Try This. Slide (Click mouse drag up) to move the paddle up, opposite for down.

Slide Paddle
B
94
S
29
G
11
Posts: 1,545
Reputation: 20,993

Post » Thu May 09, 2013 3:03 pm

Is .slide a native command on Construct 2?
B
7
S
1
Posts: 33
Reputation: 623

Next

Return to How do I....?

Who is online

Users browsing this forum: DemantDigitalArt, imothep85 and 25 guests