Back to Entry Page

The Scene Scroller Demonstration Project

A landscape image from the Scene Scroller project

Details

This project shows how to build a basic component of an arcade-style video game: a variable, constantly moving landscape scroll. The elements you see here form the backdrop of the Fallout game project.

Like the Dynamic Mask project, this movie provides a framework on which you can build your own variations for Assignment 4.

The architecture is fairly simple: there are three layers, one containing a dummy Movie Clip to hold the scripts, the other two holding two Movie Clips each containing a set of 10 images stacked in separate layers. These component images are movie clips in their own right and are given instance names within the general clip that contains them. Each image is 600x200 or 100% of the visible screen area. On load, all 20 of these images are made invisible, then one is chosen randomly from each set of 10 and made visible.

On enterFrame each of the image clips moves 10 pixels to the right. When it reaches a specified limit, the rightmost clip undergoes two changes: first, all its images are briefly rendered invisible and a new visible image is randomly selected; second, it is repositioned so that its right edge is outside the visible area.

The effect of all this trickery is a reasonably continuous, cartoon-style moving background.

One important note: because the image clip moves 10 pixels on every iteration of the script, we re-set its position to X=-590 (not X=-600, as you might expect) when it returns to the left side of the screen. This synchronizes the righthand clip with the lefthand clip, which has already moved 10 pixels to the right at the time the reset script is executed. If we don't take account of this quirk, a 10-pixel gap will appear between the image clips.

Source file

The source file sceneScroller.fla is available on Crow in MMShare/sceneScroller/.


University of Baltimore Logo

Copyright © 2002 School of Information Arts and Technologies