Object.Platform.MovingAngle resets to 0?

Get help using Construct 2

Post » Wed Nov 16, 2011 5:49 pm

[QUOTE=Ashley] The moving angle is calculated as the angle between the position of the object last tick, and the position of the object now. So if the object is not moving, the positions are the same. So what is the angle between two identical points? It just returns 0 in that case.

You could work around it by storing the angle of motion in an instance variable - if you only set it in an event when the speed is not 0, then you have a variable which is the "last moving angle" which sounds like what you want.[/QUOTE] I think this behavior is counter-intuitive for an expression supposed to return the angle of motion. Returning 0 when not moving means that the object angle of motion is pointing to the right, which isn't true.

Logically it should return "null" when the object is not moving, since there's not an angle of motion when you're not moving. However this wouldn't work for C2 system since it would broke other expressions. So I think returning the last moving angle makes more sense.

At least for every case I can image that this expression would be useful I would need to implement the work around to get the desired behavior, so I think this should be by default.
Scirra Employee
B
129
S
45
G
15
Posts: 705
Reputation: 15,413

Post » Wed Nov 16, 2011 5:55 pm

I tend to agree, for example, if I'm using two different animations for a sprite's left and right movement...

(e.g Samus' gun being on the correct arm no matter which way she faces in Zero Mission)

...then I shouldn't have to create a completely new variable to house the last known MovingAngle. I believe it should remain at whatever it was when it stopped moving, and then only change when the sprite starts moving again.
B
64
S
8
G
9
Posts: 290
Reputation: 8,590

Previous

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 9 guests