Creating the Game Intro
Games, like life, are all about interaction. Unlike life, however, most games come with a set of instructions. This Pac-Manstyle game has an introduction that serves both to introduce the character Puffin to the user and to offer a brief set of instructions for the game. Here, you will attach a script to the Enter button that will allow the user to enter the maze and begin the game.
Open the maze_start.fla file from the Projects/05 folder you copied to your hard drive during "Preparing to Work."
The game intro is in the first scene, Game intro.
The Scene panel (Windows > Design panels > Scene or Shift+F2) lists the two scenes of the maze game.
Click on the Enter button on the Stage and, using the Properties panel, give it the instance name intro _btn.
Open the Actions panel, go to the actions layer in Frame 1 of this layer, and add this script:
Listing 5.1
//Button code - jumps to scene 2 stop(); intro_btn.onRelease = function() { nextScene(); }
This script executes when the user releases the Enter button. You target the button instance intro_btn with a script on the main Timeline that instructs the player to jump to the next scene. The next scene (Tree Maze) is where the user can play the game.
NOTE
You added the _btn suffix to the Enter button instance name, instead of just naming it intro, to call up the useful Code Hint tool, as shown in the following figure. Using the Macromedia preferred suffix _btn will bring up the button properties in the ActionScript panel Code Hint window.
Save your work.