Step 1: Make the Game Objects – Movie Clips
Open a new flash document with default dimensions 550px by 400px and save it. This tutorial assumes the learner knows how to create movie clips in flash. Create movie clips required for game play as shown in the library example below.
 Flash Library Objects
Movie Clips - explained
The background movie clip. This clip will be used as the background during game play and will record the number of mouse clicks when the player misses the target. It requires a single frame and has no internal actionscript. The clip should be large enough to cover the entire scene. (default = 550 x 400 px) The cursor movie clip. This clip will be used as the cursor when playing the game. The cursor requires a single frame and has no internal actionscript. It should have its point of reference centred on the “+” sign when creating the movie clip and be approximately 30 x 30 pixels. The playGame movie clip. This clip is used as the Introduction and Play again screen. It requires a single frame and has no internal actionscript. It should be large enough to cover the scene but still show the scoreboard. (550 x 370 px) The scoreboard movie clip. This clip will be used to display the number of clicks, score and missed targets. It requires a single frame and has no internal actionscript. Three dynamic text boxes are required in this clip (instance names: clicks, score, miss). Dimensions: (550 x 30px). The target movie clip. This clip will be used as the moving target when playing the game and will increment the clicks, score and miss variables on the scoreboard. It requires two parts (several frames).
Target Clip part 1.
In frame 1 create 2 layers, draw the target for the player to hit in layer 1. Add the following actionscript in frame 1, layer 2. stop();
Target Clip part 2.
In frame 5, layer 1, insert a keyframe and give it a Frame Label of 'pop' in the Frame Properties panel. Over several keyframes (6, 7, 8, 9, 10), change the drawing to make the target pop, disintegrate, explode, etc. The last keyframe should be empty (no graphics). In the last frame of the target, layer 2, insert a keyframe and add the following actionscript. this._x = 600; this._y = Math.random()*250+50; this.speed = Math.random()*12+2; this.clicked = false;
Actionscript Explained:
These lines of actionscript are used to reset the target after it has been hit by the player. this._x = 600; Places the target off to the right-hand side of the game screen. this._y = Math.random()*250+50; Will return a number between 50 and 300 for the ._y property of the target. this.speed = Math.random()*12+2; Will return a number between 2 and 14 to set the speed of the target. this.clicked = false; Tells the game that the target has finished popping and is ready to be hit again.
Save Now!
|