How do you get the x- and y- speeds of a sprite?

For questions about using Classic.

Post » Tue Oct 19, 2010 12:36 pm

How do you get the horizontal and vertical speeds of a sprite?
spritename.??
B
5
S
1
G
3
Posts: 59
Reputation: 993

Post » Tue Oct 19, 2010 1:32 pm

example. maybe needs clean up, maybe not)
[url:39ks5t09]http://www.box.net/shared/0sqq96gjra[/url:39ks5t09]

also if you need absolute value of speed (i mean moving right speed 300, moving left speed also 300 (not -300 as in example)), just put all in abs()
B
19
S
6
G
4
Posts: 171
Reputation: 2,507

Post » Tue Oct 19, 2010 3:03 pm

This is weird... Construct says I can't open that .cap file because I don't have the latest version of Construct, but I have already been using 0.99.95
B
5
S
1
G
3
Posts: 59
Reputation: 993

Post » Tue Oct 19, 2010 5:08 pm

Sorry - using construct 0.99.96 - last "unstable" build


-> Sprite: Set 'old_x' to Sprite.Value('x')
-> Sprite: Set 'x' to Sprite.X
-> Text: Set text to (Sprite.X-Sprite.Value('old_x'))/Timedelta

'old_x' and 'x' - prvate variables. Text - just text to display current Speed.
B
19
S
6
G
4
Posts: 171
Reputation: 2,507


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest