Game Development Reference
In-Depth Information
Figure 10-2. Orb Destroyer game in action
The final function in the run method is used to check on the progress of the game. When all orbs have been
destroyed, the GameStateEvents.GAME_OVER event is dispatched.
Building the Orb Sprite
The PulsingOrb sprite from Chapter 8 will be reused for the orbs in the game class. For the purposes of this game, one
more property needs to be added to hold the speed of each orb (see Listing 10-14).
Listing 10-14. PulsingOrb.js - The Orb for Orb Destroyer Uses the PulsingOrb Class (Built in Chapter 8)
(function () {
var PulsingOrb = function (color, size) {
this.initialize(color, size);
}
var p = PulsingOrb.prototype = new createjs.Shape();
p.count = 0;
p.speed = 0;
p.size = 0;
p.Shape_initialize = p.initialize;
 
Search WWH ::




Custom Search