Introduction to Flash and Actionscript
S7 - Really Cheesy Avoiding Game
Tutorial 1 - Using Arrays
Hittest using Arrays
Create a new Air Application
for IOS or Android
ICS3U and ICS3C
of the sample code in this section is not documented. Make sure you
add your own documentation!!!!!!
Most of the sample code in this section is not documented. Make sure you add your own documentation!!!!!!
1 - Using Single Instances
Assignment 1 - Using Single Instances
Find 2 different angry bird images, one with an open beak and one with a closed beak (or any character you like with 2 different positions)
Repeat for a different angry bird
Step 2 - Use the images to create a movie clip so that it appears as if the mouth of the bird is opening and closing
Step 3 - Using addchild to create instances of the AngryBird.
Step 4 - Move the birds down the screen (The +2 and +3 are the speed of the birds)
Step 5 - Your turn!!! Have the birds start over at the top when they reach the bottom.
HINT: In the function birdsFall use an if statement to check
> than some number)
// reset the y coordinate
// generate a new random x coordinate
Step 6 - Randomly generate the speed of the birds.
Step 8 - Add a Character that will try to avoid the birds. (Use code). Use the Keyboard to Move the Pig. To avoid having to click on the stage every time add the following after your last addchild
stage.focus = stage;
If your Keycode is glitchy you can modify using the code below. This uses arrays but you do not need to have completed the array tutorial to modify your code. See below.
Step 8- Checking for collisions and end the game. (Note: Don't forget to add stop() to both scenes)
Hittest each bird using the OR function (|| found over the ENTER key)
Step 9 - Adding Sound Effects and Background Music
Assignment 2 - Using Arrays of Birds
Step 1 - Add a second level that uses arrays to create and hittest the birds
Using arrays to make multiple birds
To make your birds start at different times place the above code on a timer, you may want to use less than 10 each tick.
Create EventListeners and functions for the following:
Create a RandomSpeed array to change
the speed of each bird.
Use a for loop to make the birds fall at the RandomSpeed
Use a for loop to reset the birds
back to the top when they exit at the bottom.
This time use the Mouse to move the Pig
You may want to hide the mouse at the start
Step 2 - Create a function that uses
a for loop to hittest the pig and the bird
Add a Scoring System and Lives
Level 3 (ICS3U)
Randomly Generate the Bird that will Appear and the number of birds.
Hint: Generate a random number, then use if statements to determine which bird is created.
1. An Intro Screen
2. A Menu Screen that allows you to pick your Level
College students 2 different levels
files to your website as usual
Upload files to your website as usual
your app onto your device or one of the schools.
Load your app onto your device or one of the schools.