With our new project in place, let’s start coding our player’s movement. We’re going to get a little fancy with it to exercise our programming skills and learn about some new methods.
As we mentioned in the last chapter, we want movement to be fluid – not jerky, but not slippery, either. A little bit of time to build to the maximum speed will make it less of a sudden jerk when the player begins moving. Likewise, we want some time to lose speed after you stop holding down the movement keys. It won’t be much, ...