How do I swipe a block accross the screen

Get help using Construct 2

Post » Wed Apr 02, 2014 2:59 am

I have 2 blocks , I would like to swipe them one at a time right,left,up,down with my finger. How do I achieve this with the touch input.

Image
B
2
Posts: 7
Reputation: 164

Post » Wed Apr 02, 2014 9:46 am

Use Drag & Drop behaviour
I will not let you reach the sisters
Nature Forums
B
11
S
5
G
2
Posts: 496
Reputation: 2,306

Post » Wed Apr 02, 2014 1:13 pm

Doc Ai wrote:Use Drag & Drop behaviour



Thanks for the reply, I did use drag and drop but how do I make the box continue to slide for a little after I take my finger off it?
B
2
Posts: 7
Reputation: 164


Post » Wed Apr 02, 2014 1:54 pm

Lordshiva1948 wrote:Try this link you might find what you looking for


Thanks but this is not exactly what I'm trying to do.

I'm trying to swipe the boxes individually around the screen with finger but when I take my finger off the box it does not continue in the direction I swiped it for a short distance. I got the boxes to move with drag and drop but when I take my finger off the box it stops right away.
Last edited by kiwis on Wed Apr 02, 2014 3:34 pm, edited 1 time in total.
B
2
Posts: 7
Reputation: 164

Post » Wed Apr 02, 2014 3:06 pm

You just check the direction it was going when it was dropped.
Like if the x when it was dropped was so much greater than the x it had when it was picked up, then you know it was swiped right.
Image ImageImage
B
169
S
50
G
173
Posts: 8,313
Reputation: 110,270

Post » Wed Apr 02, 2014 3:39 pm

newt wrote:You just check the direction it was going when it was dropped.
Like if the x when it was dropped was so much greater than the x it had when it was picked up, then you know it was swiped right.


how do I go about doing this ?
B
2
Posts: 7
Reputation: 164

Post » Wed Apr 02, 2014 3:45 pm

On drag, or touch store the x, and y of the object to a variable.
Then when its dropped compare the objects position to the variables.
You'll need extra sub events for all the different directions you want to compare.
Image ImageImage
B
169
S
50
G
173
Posts: 8,313
Reputation: 110,270

Post » Wed Apr 02, 2014 3:58 pm

newt wrote:On drag, or touch store the x, and y of the object to a variable.
Then when its dropped compare the objects position to the variables.
You'll need extra sub events for all the different directions you want to compare.


Can you show how the commands should look in construct? maybe a screenshot please ?


edit , I'm new at this
Last edited by kiwis on Wed Apr 02, 2014 4:18 pm, edited 2 times in total.
B
2
Posts: 7
Reputation: 164

Post » Wed Apr 02, 2014 4:03 pm

Might check the how-to examples:
how-do-i-frequently-asked-questions_t63692
Image ImageImage
B
169
S
50
G
173
Posts: 8,313
Reputation: 110,270


Return to How do I....?

Who is online

Users browsing this forum: adventurist, Blendi1223 and 27 guests