Book Image

Creative Greenfoot: RAW

By : Michael Haungs
Book Image

Creative Greenfoot: RAW

By: Michael Haungs

Overview of this book

Table of Contents (17 chapters)
Creative Greenfoot
About the Author
About the Reviewers

Dynamically generated worlds

It would seem creating worlds that are dynamically generated and potentially endless would be the concluding topic of this chapter, instead of the introductory one. On the contrary, dynamically creating a world is easy, and we have already seen all the coding necessary to do so. In Chapter 1, Let's Dive Right in…, we dynamically created enemies in Avoider Game that streamed down from the top, and later, in Chapter 2, Animation, we added a dynamically generated star field. We will use the same techniques to create a seemingly endless world. Imagine that the enemies in Avoider Game were generated less frequently and looked like planets. It would look like we were travelling through space. Imagine we had a green background and used an image of a tree for our enemies. It would look like we were walking through a forest. Next, we will create a Greenfoot scenario that displays a user-controlled rocket flying through a cloudy sky.


We are going to create...