Author: Matt Slaybaugh
Date: October 25, 2006
Level: Beginner
Scuba Diver is a game in which the player uses the arrow keys to move the swimmer to the goal, off the right side of the screen, before running out of air. Avoid colliding with the fish, which makes you lose air faster!
In this tutorial, you will change the values of some of the variables in the application to make the game easier
- Basic Flash experience
- Flash 8
- myglife_scuba.fla
This software is licensed to the public under the CC-GNU GPL.
The number of the fish in the Scuba Diver game
is determined by a variable in the application.
A variable is a container for information that may change while running an application. In Scuba Diver, one of the variables is the amount of oxygen in the swimmer's tank.
One type of variable is called a constant. The values of constants do not change while running an application.
In Scuba Diver, two of these constants are totalFish and maxtimer.
- Open myglife_scuba.fla in Flash.
- Locate the top layer, named Actions and click on the third frame.
- Expand the Actions panel by clicking on its title bar. If you do not see the Actions panel, open the main Window menu and click Actions.
The constants in Scuba Diver are set in the script
on the third frame of the timeline in the layer named 'Actions'. - In the Actions panel, scroll down until you see line 16, where
totalFishis set to the value of 38. This is the number of fish the swimmer will encounter in the game. - Make the game a little easier by changing the value of
totalFishto 25. - In the Actions panel, scroll further down until you see line 20, where
maxtimeris set to the value of 1500. This is the duration of the game, measured in frames. The game runs at 12 frames per second, so 1,500 frames is about two minutes. - Make the game a little shorter by changing the value of
maxtimerto 1000 (don't include a comma) which will make the game last a little under a minute and a half. - Save your changes and publish the application.
- Run the game in a browser and you will see fewer fish and find that the game ends more quickly.
