Sprite movement and velocity

Started by
2 comments, last by micco 21 years, 10 months ago
I am having difficulty developing a method of moving sprites smoothly across the screen at different speeds. The method I have already tried causes the sprite to move more than one pixel at a time depending on the speed. i.e. the highest speed would mean skipping ten pixels at a time making the movement look jerky. Could anyone provide a better method than this? Thanks micco
Advertisement
Don''t update all the sprites for each frame. Set it so the ones with a slower velocity will only move every x frames or so. Base it all off the fastest one...
If you have a sprite that moves (for example) 100/pixels per second and you are running at 10 fps, you will move 10 pixels per frame. There is no way around this other than either slowing down your sprite speed or increasing your framerate.
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
Sounds like you shouldn''t be basing your sprite movement on pixels per frame, but on pixels per second.

Then you time how long a frame took, and move your sprites by that number of seconds worth of pixel travel.

Here''s the article right here on GameDev for those lazy types that don''t search. I''ll still make them copy n paste though, mwahahaha! :-)

http://www.gamedev.net/reference/articles/article1382.asp

Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions

This topic is closed to new replies.

Advertisement