Skip to main content
gamedev.net
🔒 Locked

Moving Sprites

Started by Hippokrates Jul 28, 2002 at 9:40 AM 1 replies 250+ views
Original Post
Hippokrates
Hippokrates
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
Im Anfang war die Tat...Faust
Pipo DeClown
Pipo DeClown
how do you do the second without doing while or setting flags?
or is it with flags?
Hippokrates
Hippokrates
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
Im Anfang war die Tat...Faust

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.