View Full Version : 2D movement algorithms
04-17-2003, 04:04 PM
Hi =) does anyone have a hint on making a smooth 2D movement of a square moving with keyboard control (holding key to move, not continous movement) in a full screen animation? no matter how small i put the movement unit, it always looks kinda false.
Thanks for any help
JML from PT
04-18-2003, 05:24 AM
I'm assuming with each key event, you are moving a certain distance?
Instead try to have a boolean flag for moving that gets set to true on the key down, and false on the key up. Then in the animation loop if it's true, you move based on the time that's elapsed since the last animation frame.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.