previous/last tick position

New releases and general discussions.

Post » Wed Feb 03, 2010 4:10 pm

get last tick x, y and position of any sprite. I know than can be done manually, but it would be handy to get custom "is moving", direction, velocity...
B
30
S
15
G
10
Posts: 285
Reputation: 7,144

Post » Wed Feb 03, 2010 4:21 pm

Would this retrieve the X coordinate of the sprite the last time it was drawn (ie. the previous tick) or literally the last position (eg. Set X to 5, Set X to 10, Set X to 15 all in one event, then last position returns 10)?

Even so it's pretty simple to do yourself, and it's hard to fit it in to the engine considering plugins, behaviors and events can all modify an object's position.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Wed Feb 03, 2010 5:42 pm

the first one, the last drawn position.
B
30
S
15
G
10
Posts: 285
Reputation: 7,144

Post » Wed Feb 03, 2010 7:50 pm

you could use private vars lastx,lasty and stuff the current position on them at the end of each frame.


[code:3eatwfxv]+ System: Always (every tick)
-> Sprite: Set 'lastx' to Sprite.X
-> Sprite: Set 'lasty' to Sprite.Y
[/code:3eatwfxv]
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665


Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 2 guests