Archived

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

micco

Sprite movement and velocity

Recommended Posts

micco    122
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

Share this post


Link to post
Share on other sites
powdahound    158
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...

Share this post


Link to post
Share on other sites
CrazedGenius    156
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.

Share this post


Link to post
Share on other sites
siaspete    208
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

Share this post


Link to post
Share on other sites