Random Scrolling Terrain

How can i make a flash movie that generates random scrolling terrain?

That’s a pretty broad question, you might want to narrow it down to the parts you don’t understand, or are having the most trouble with. If you are just starting out in flash you might want to consider checking out some tutorials on basic movement, and Actionscripting, then work your way up to the more complicated stuff like this.


Um. First of all i would like white at the top and bottem of the movie that is randomly generated :slight_smile:

The terrain should get more wavy as it goes along, howeven top and bottem must be at greater than or equal to 100 pixels away.

Like shown in the attachment.

After that i would like the terrain to scroll along in the oppisite dierection of what key is pressed. (For example if right is press the terrain goes left.)
Finally i don’t want the terrain to stop dead when the keys are not being pressed :). I would like it to gradually stop.

Thats my aim. Thank you :smiley:

Phew. Well I’m going to suggest you take a different approach…

Unless you’re comfortable calculating arcs and working with the lineTo/curveTo function and have a random-vertices script, just do this:

Create a background that is far wider than your SWF stage, read up about continuously-scrolling BGs in Flash and apply it to your background(s). Rinse and repeat for however many background you might need.

Odds are that your users aren’t going to notice it’s the same BG being scrolled as long as it’s wide enough to provide a good mix of variation. You can also load-in another BG once a certain one has played, and even have a set of BGs that Flash cycles through.

Seriously, unless you’re VERY, VERY comfortable with OOP and ActionScript (or your name is Keith Peters), just pre-render the BGs and walk away…seriously.

But if you’re hell-bent on doing it the ActionScript way (which is commendable but also borderline insane), check this site out:

Keith has some of the most advance ActionScript knowledge on the planet (second only perhaps to the programmers at Macromedia), and specializes in random-generation and dynamic content.

Best of luck!