Movement in SDL
I'm not sure if LazyFoo's tutorials mentioned this, but an alternative to storing an array of keys is to increase the x and/or y velocity of the object at time of KeyDown, and subtract that velocity at time of KeyUp. The object still moves while the user holds the key down, and stops when they release.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement