Jump to content
  • Advertisement

Archived

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

Hippokrates

Moving Sprites

This topic is 5807 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!