Cannon Game: Preliminary Instructions and Notes
Open the template file named CannonTemplate.fla from Chapter 17’s examples folder. We’ll build our game from this template. For this case study, the graphics have already been created so that we can focus on the ActionScript. We created all the images using Flash. Chapter 16 provides a detailed coverage of Flash’s graphical capabilities. Take a minute to familiarize yourself with the symbols in the Library. Note that the target movie clip has movie clips within it. Also, the ball, sound, text and scoreText movie clips have stop actions and labels already in place. Throughout the game, we play different sections of these movie clips by referencing their frame labels. The stop action at the end of each section ensures that only the desired animation will be played.
Before writing any ActionScript to build the game, we must label each frame in the main timeline to represent its purpose in the game. First, add a keyframe to frames 2 and 3 of the Labels layer. Select the first frame of the Labels layer and enter intro into the Frame Label field in the Property Inspector. A flag should appear in the corresponding box in the timeline. Label the second frame game and the third frame end. These labels will provide useful references as we create the game.
Using the Actions Layer
In our game, we use an Actions layer to hold any ActionScript attached to a specific frame. ActionScript programmers often create an Actions layer to better organize Flash movies.
Add keyframes in the second and third frame of the Actions layer, and place a stop func-tion in all three frames.
Copyright © 2018-2020 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.