Time based movement question
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
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
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement