Sound, Game Logic, Inter-Object Communication, and the Player
In this chapter, we will quickly implement our game’s sound. We have done this before, so it won’t be hard. In fact, in just half a dozen lines of code, we will also add music playing to our sound features. Later in the project (but not in this chapter), we will add directional (spatialized) sound. This time, however, we will wrap all our sound-related code into a single class called SoundEngine
. Once we have some noise, we will then move on to get started on the player. We will achieve the entire player character functionality just by adding two classes: one that extends Update
and one that extends Graphics
. This creation of new game objects by extending these two classes will be how we do almost everything else for the entire game. We will also see the simple way that objects communicate with each other using pointers. The completed code for this chapter can be found in the Run2
folder.
In a nutshell...