Planning the level map

Before we start building anything, let's take a moment to think about how this automatic level building is going to work and what we need to do to build it.

Engage thrusters

We intend to create a maze-like level design viewed from the top, similar to the look of the conventional maps. We want to create varying levels dynamically, so we should break the stage up into tiles that can each contain a different graphic. All these tiles placed side by side will create the complete level.

Now for the math involved. We know the entire stage is 480 pixels wide and 360 pixels high. So the tiles have to be of a size that can easily divide the stage in equal segments without any leftover space. It's also useful if the tiles are square. ...

Get Scratch 2.0 Game Development HOTSHOT now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.