Game Development Reference
In-Depth Information
5.
Also, check under each costume if each image is indeed 60 x 60 pixels in size.
6.
Rename the sprite to tileGenerator to make clear what this sprite is meant to do.
Objective complete - mini debriefing
This concludes the graphical element of our ile generator. The next step will be to add a
script that will use the iles to stamp images on the stage, creaing a complete level map.
Creating a level generator
We will add a script to the sprite we just created that selects a costume at random and
copies it onto the stage. With a double for loop, we will make sure the ile generator steps
around the enire stage, so no space is let blank.
Prepare for lift off
To set up this game, we will create a small control script in the Stage object to set everything
in moion as follows:
1. Start a new script with the when <space> key pressed block.
2. Atach a broadcast message to this.
3.
For the message, type createMaze :
This message will trigger when a new maze should be generated. It can be acivated
by pressing the Spacebar key and at a later stage, through the script when the player
completes a level.
Engage thrusters
With the basics out of the way, we can start with the fun stuf; drawing levels automaically.
We will draw the level from the lower-left to the upper-right of the screen using the
following steps:
1. Go to the script tab of the ileGenerator sprite.
2. Start a new script with a when I receive <createMaze> block.
3. When the script receives this message, click on the clear opion to clear the stage.
 
Search WWH ::




Custom Search