Coding the Platforms, Player Animations, and Controls
In this chapter, we will code the platforms, player animations, and controls. In my opinion, we have done the hard work already and most of what follows has a much higher reward-to-effort ratio. Hopefully, this chapter will be interesting as we will see how the platforms will ground the player and enable them to run as well as see how we loop through the frames of animation to create a smooth running effect for the player.
We will do the following:
- Coding the platforms: You guessed it. Two classes are needed – one derived from
Update
and one fromGraphics
. - Adding functionality to the player.
- Coding the
Animator
class. - Coding the player animations: Add a smooth-running animation to the player.
The completed code for this chapter is in the Run4
folder.