Need help with touchspeed

Get help using Construct 2

Post » Mon Jan 05, 2015 2:29 am

In my game the player sprite is moved by dragging it. How can I make it mirrored/not mirrored in one continuos dragmove? Tried with compare touchspeed but there seems to be no negative value on it: If touchspeed > 0 then set to not mirrored If touchspeed < 0 set to mirrored.

Is there some way to compare player.X to player.prevousX ?

Thanks
B
33
S
10
G
6
Posts: 259
Reputation: 6,801

Post » Mon Jan 05, 2015 10:13 am

So two ways come to mind.

You either store the previous player position in a variable then compare it to the present position to find out if it is to the left or right. It's probably easier to push a new position into the array if it is different from the last tick. Then compare the first point in the array with the second.
or
You get the touch positions and compare those. If my understanding is correct while you are touching an array of touch positions are stored. So you could compare the last position with the previous again similar to the above.
ImageImageImageImageImage
B
19
S
5
G
1
Posts: 614
Reputation: 2,542

Post » Mon Jan 05, 2015 1:34 pm

Yes that helped, thanks! Here´s what I did:
Image
B
33
S
10
G
6
Posts: 259
Reputation: 6,801

Post » Mon Jan 05, 2015 2:11 pm

No problem. Glad I could help! ;)
ImageImageImageImageImage
B
19
S
5
G
1
Posts: 614
Reputation: 2,542

Post » Mon Jan 05, 2015 2:32 pm

Went onto facebook and liked your page :)
B
33
S
10
G
6
Posts: 259
Reputation: 6,801


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 20 guests