Game Development Reference
In-Depth Information
Finally, you have to make sure the game isn't updated when the help frame is displayed. You can do
that in the update method by updating the game objects only if the help frame isn't visible:
var helpFrame = this.root.find(ID.help_frame);
if (!helpFrame.visible)
GameObjectList.prototype.update.call(this, delta);
One more thing you have to take care of is that by pressing the help button, the player pauses the
game. If you keep showing the jewel grid, this provides the player with a means to gain extra time to
try to find jewel combinations. Of course, this isn't what you want! Fortunately, in the current class
structure, this is very easy to solve. Add the following two lines to the update method:
var grid = this.root.find(ID.grid);
grid.visible = !helpFrame.visible;
These lines ensure that whenever the help frame is visible, the grid isn't, and vice versa. Figure 16-2
shows the game when the help frame is displayed.
Figure 16-2. Screenshot of the help frame display in the game
Search WWH ::




Custom Search