I experimented with this. The best I have found so far is to record the state of the input keys in the internal state, modified by keyDown: and keyUp :, and run NSTimer to apply them. The timer uses the actual measured time delta between shots to determine how far to move the camera. Thus, irregular timings do not have too much effect (and I can call my method to update the camera position at any time, without worrying about changing the speed of its movement).
It takes some work to get it right. keyDown: and keyUp: there are some unpleasant behaviors when it comes to game input. For example, repeating keys. In addition, they can work even after your presentation loses focus, or your application goes to the background if the keys are held in transition. Etc. Not irresistible, but annoying.
What I have not done yet is to add acceleration and deceleration, which, I think, will help to perceive it smoothly. Otherwise, he feels rather well.
source share