Game Development Reference
In-Depth Information
the InvinciBagel will go right over the Treasure objects without seeing (colliding with)
them!
Figure 17-17 . Add iTR0 and iTR1 Treasure objects inside the .addCurrentCast(Actor. . .) method call
Now that we have added these two Treasure objects to the castDirector CastingDir-
ector object, the collision detection programming logic will “see” them, and collisions
with the Treasure objects will occur, triggering the scoring engine to score the game
correctly. Test the final code for implementing Treasure in your game, and make sure
that it works, and then we can move on to adding adversaries and have them shoot
projectiles at the InvinciBagel character.
Adding Enemies: The Enemy and Pro-
jectile Classes
Now that we have added positive (Treasure) elements to our game, let's add some neg-
ative (Enemy and Projectile) elements to the game, so that we remain “balanced” in our
development work process. We are going to use the Actor superclass, rather than the
Hero superclass, to create the Enemy and Projectile classes (objects). This is because
 
Search WWH ::




Custom Search