Title: Intro to Flash Game Design
1Intro to Flash Game Design
2Basic Components
- Splash Screen
- Cut Scenes
- Introduction
- Directions
- Game Play
3Hands On
- Movement/Navigation
- Adding Sound
- Collision detection
- Keeping Score
4Movement
- Name RII
- Create an ActionScript Layer
- Select the first frame in the ActionScript Layer
- Open Actions Frame
- Begin Coding
5Movement Code Sample
if (Key.isDown(Key.UP)) xSpeed
thrustMath.sin(turtle._rotation(Math.PI/180))
ySpeed thrustMath.cos(turtle._rotation(Math.P
I/180)) turtle.gotoAndStop("forward") forward(
)
6Navigation
- Name your buttons
- Name the key frames for Introduction,
Directions, etc. - Select the first frame in the ActionScript Layer
- Open Actions Frame
- Begin Coding
7Navigation Code Sample
playB.onPress function() gotoAndStop("Game")
console._visible 1 activate true
8Adding Sound
- Import sounds to your Library
- Set the Linkage properties to Export for
ActionScript - Give the sound a name (Identifier)
- Select frame 1 on the ActionScript Layer
- Open Actions Frame
- Begin Coding
9Sound Code Sample
forward function() thruster new
Sound() thruster.attachSound("thrust") thruste
r.start()
10Collision Detection
- Use the hitTest function to detect when theres
a collision between the Seeker and RII. - Program action to take when a collision has been
detected.
11Collision Code Sample
if(seeker.hitTest(turtle)) seeker._rotation
180 exSpeed -15 eySpeed
-15 seeker._y - eySpeed seeker._x
exSpeed // Play Collision
Sound bounce()
12Keeping Score
- Set a value for the score variable
- Assign the score variable to the Dynamic text
field located on the Console Clip - In the RII demo each time the Seeker and RII
collide 100 points is added to the score
13Score Code Sample
if(seeker.hitTest(turtle)) hitcnt-- score
score 100 if (hitcnt
4) seeker.gotoAndStop("green") else if
... else if else if else if
else hitcnt 5 seeker.gotoAndStop("blue")
14References
Books Macromedia Flash MX 2004 ActionScript
Training from the SourceMacromedia Flash MX 2004
Game Design DemystifiedGame Development with
ActionScriptActionScript Cookbook Macromedia
Flash MX 2004 Games Most Wanted - I haven't used
this book myself, it was recommended to me by a
friend. Websiteshttp//www.flashkit.com/tutori
als/Games/ http//www.hotscripts.com/Flash/index.h
tml