Jump to content
  • Advertisement

Archived

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

Qoy

Time based movement question

This topic is 6643 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''m doing movement for sprites and level scrolling in my game based on time, and this is NOT another post asking how to do it! But what I have so far is this: worldY -= timeDiff * LEVEL_SCROLL_SPEED; timeDiff is the difference in milliseconds from the last frame to this frame, and LEVEL_SCROLL_SPEED is, at this point .04f, or 40 pixels per second. WorldY is an int, timeDiff is an int (both unsigned) and LEVEL_SCROLL_SPEED, of course is a float. I''ve heard that conversion from int to float is VERY slow, but I can''t think of another way to do this. Is it acceptable (speed wise) to do it this way? Thanks! ------------------------------ Jonathan Little invader@hushmail.com http://www.crosswinds.net/~uselessknowledge

Share this post


Link to post
Share on other sites
Advertisement
http://www.velocity.net/~waz/glgamedev/

there's a (sort of) good article talking about it there.

It might help

MENTAL

PS: as long as you dont force C++ to do any divides, everything's fast . In other words, yes it's fine. you might want to speed it up with assembler at a much later date (when the rest of the project is finished).

Edited by - MENTAL on 4/15/00 3:44:27 PM

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!