How do I detect which direction a sprite is being dragged?

Get help using Construct 2

Post » Thu Feb 23, 2017 2:53 pm

Hi, sorry if this has been answered somewhere, I couldn't find it with the searches I put in..

I'm trying to detect if a dragged sprite is basically being dragged either to the left, right, up or down.

So as an example imagine a sprite with 5 frames:

0: dot
1: right arrow
2: left arrow
3: up arrow
4: down arrow

If you drag the sprite to the right, I'd want to detect that and tell the sprite to go to frame 1
alternatively if you drag the sprite up, to go to frame 3 etc.

Any advice or tips would be greatly appreciated!
B
16
S
4
Posts: 50
Reputation: 1,030

Post » Thu Feb 23, 2017 3:24 pm

[deleted link]
Last edited by MPPlantOfficial on Thu Feb 23, 2017 4:41 pm, edited 1 time in total.
Image Image Image
B
29
S
11
G
27
Posts: 729
Reputation: 16,995

Post » Thu Feb 23, 2017 4:16 pm

That's a pretty nifty way of going about it, I'll play around with that in my project thanks!
B
16
S
4
Posts: 50
Reputation: 1,030

Post » Thu Feb 23, 2017 7:53 pm

You can always check a sprites position X and Y.

You can also check angle facing and if a bullet you can check angle of motion.

Any of those can be used to determine which direction a sprite is moving or will move next.
Banned User
B
23
S
6
G
58
Posts: 1,229
Reputation: 34,540

Post » Fri Feb 24, 2017 2:46 pm

I was trying to figure it out via X and Y but wasn't sure how to do it relatively to the sprites current position.

I'll try making it a bullet and see if that is any better than the way MPPLant suggested, thanks
B
16
S
4
Posts: 50
Reputation: 1,030


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests