We want to start with the basic element of the game, the CLBike
class
. We will look at this class in detail here, but first we want to see the CLDefinitions.h
file.
// Audio definitions #define SND_BUTTON @"button.caf" #define SND_TURN @"bike_turn.caf" // Graphics definitions #define IMG_BIKE @"lightbulb.png" #define IMG_GLOW @"glow.png" #define IMG_BUTTON @"rightarrow.png" #define IMG_SPECK @"whitespeck.png" typedef enum { kBluePlayer, kRedPlayer } PlayerID; typedef enum { kNoChange, // NoChange only used in bluetooth games kUp, kRight, kLeft, kDown } Direction;
Here we have a few definition for our graphic and sound assets. Centralizing the definitions makes it much easier to change your filenames in one place, rather than hunting through your code for all references.
We also create two typedef
enum
definitions. The PlayerID
holds a value to make it easier to determine which player is being addressed. Likewise...