Accessing a sprite's current speed

For questions about using Classic.

Post » Wed Jan 21, 2009 1:36 am

I want to set an object to a different animation depending on how fast it is currently going. I can't seem to find any way to access this data though, even though it clearly must have it as a variable somewhere, since I can set max speeds. Is there any way for an event to include a condition based on a sprite's speed, or other variable not in the list of things I can select in the wizard?
B
2
G
3
Posts: 71
Reputation: 992

Post » Wed Jan 21, 2009 1:57 am

What behavior are you using? Although in all of the behaviors that involve user movement there's a tab for the behavior when retrieving expressions. The expression for retrieving a platform objects X speed, for instance, would be:

Sprite[Platform].VectorX

Of course, you'd change "Sprite" to whatever your object is called, but that's about it. I hope I explained all that well enough. :)
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Wed Jan 21, 2009 2:01 am

I'm using the Platform behavior.

I guess what I don't understand is how to add an event that isn't in the wizard. So I'd want to have an event where the condition is "Player[Platform].VectorX Greater than 300", but I can't seem to figure out how to put it in.
B
2
G
3
Posts: 71
Reputation: 992

Post » Wed Jan 21, 2009 2:05 am

You can do it with the System object. There's a general "Compare" condition that lets you access the expressions for objects if there isn't a built-in condition for them.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Wed Jan 21, 2009 2:12 am

Thank you!
B
2
G
3
Posts: 71
Reputation: 992


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 7 guests