Archived

This topic is now archived and is closed to further replies.

Hippokrates

Moving Sprites

Recommended Posts

I know 2 possible methods of moving sprites involving time based movement. 1. Simply add (timedifference * speed) to actual position 2. Set a point the sprite should move to and the sprite will update its position every frame (using the above technique of course) The second has the advantage that I could simply specifie a point it must move to and the sprite will (over several frames, of course). Now I would like to know which method is better and if there are other options. Im Anfang war die Tat... Faust

Share this post


Link to post
Share on other sites
I do it like this:
I have 4 variables (assuming 2D at the moment but I will use it 3D later on) called MovedX, MovedY, DestX, DestY.
The Dest variables hold a amount of pixels to move the sprite (in 3D it will be units of course) and the Moved variables hold the amount of movement I have already accomplished.
If Moved < Dest I will move on otherwise I will not.

Im Anfang war die Tat...
Faust

Share this post


Link to post
Share on other sites