How do I check if object is moving left or right?

Get help using Construct 2

Post » Fri Feb 28, 2014 1:28 pm

seems like it should be simple, but I can't figure it out. The only way i can think of is to check if the direct controls for left/right are being pressed, but that's not consistent with how we have the check for jumping or falling programmed.
B
35
S
5
Posts: 411
Reputation: 3,406

Post » Fri Feb 28, 2014 1:40 pm

You can use variable for store X position and compare it it object.X position when needed.
ImageImageImageImage
B
158
S
66
G
43
Posts: 2,603
Reputation: 35,868

Post » Fri Feb 28, 2014 4:36 pm

I think there's a check vector thing.
I will not let you reach the sisters
Nature Forums
B
11
S
5
G
2
Posts: 496
Reputation: 2,306

Post » Fri Feb 28, 2014 11:45 pm

ah, i guess i could do a mix of : is character moving & compare speed > 0.

I just set it set my variable to true of any of the move left/right buttons are held down
B
35
S
5
Posts: 411
Reputation: 3,406

Post » Sat Mar 01, 2014 12:48 am

Doc Ai wrote:I think there's a check vector thing.

Doc Ai is right, you can check if Platform.VectorX is positive or negative.
The manual should be read :idea:

https://www.scirra.com/manual/100/platform
At the bottom

And not to forget the case if VectorX = 0, not moving left or right.
French developper based in La Rochelle/Tours
Machines I used to play or develop games : Amstrad, Atari, Amiga, PC, PS, Xbox, mobile
B
11
S
2
Posts: 69
Reputation: 819

Post » Sat Mar 01, 2014 1:01 am

If you are mirroring your sprite when moving left or right you can just use mirrored to detect if they are facing left.
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,603


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 24 guests