TUTORIAL: Building games in Flash 5
Part 2: Scrolling backgrounds.
Author:
David Doull
Date: 10/04/01
Download source files: tut2.zip
Aim:
This is the second part of a series of three tutorials that
cover the techniques involved in building games in Flash 5.
The first tutorial covers player movement and fire - if you
haven't read it check it out: tutorial
1. This tutorial will cover scrolling backgrounds.
Assumed Knowledge:
It is assumed that you have a basic understanding of Flash
and Actionscript. You should understand variables, properties,
if statements and the basics of the flash 5 'dot syntax'.
It is assumed that you have read tutorial 1.
By the end:
at the end of this tutorial you will have built a scrolling
background for you game as shown below. You will also be introduced
to the KeyUp clipEvent and parallax scrolling.
Click anywhere on the black to ensure
that the flash file has the 'focus'
Use the arrow keys to move, Ctrl to fire.
OK, let's get started.
The first thing we are going to do is
to produce some ground that will scroll past as the spaceship
flys over it.
Open up the flash file you produced at
the end of tutorial 1 (or you can get it here).
Create a new layer (called ground)
and draw some interesting ground - a few bumpy lines and some
gradient fills should do the job. Make sure that the ground
is the exact same size as the flash stage. Also make sure
that ground will tile horizontally - so ensure that the ground
starts and ends at the same height.
Select the ground, choose Insert and
Convert to Symbol (or F8) and make your ground a movie clip.
Select this ground movie clip and in
the Instance panel set the movie clips name to ground
(as shown below).
If you don't want to draw the ground
you can download this fla; tutorial2_parta.fla,
with this step already done for you.