In the following chapter, we are going to build a game called Resident Raver, in which the player controls an unnamed hero who is trying to escape a college dorm overrun by raver zombies. The hero has several weapons at his disposal to help him escape, while also navigating platform-based obstacles. I have gone ahead and created all the assets you will need for the final game.
Before moving onto the next section, make sure you copy over the contents of the media folder that is included in the book’s example files folder. This will contain all the assets you will need for the rest of the book. In it you will find sprites, map tiles, and sounds.
It’s okay to replace the default media directory with the one we will be using for this book.
Now that we have learned about creating graphics for our game, we
can start building our first level. Let’s open up Weltmeister and create a
simple level. When you open up Weltmeister for the first time, you will
see that an
untitled.js file has been
created for you, but that the level is empty. Before we can even start
creating our level, we will need to add our map tile sprite sheet. Create
a new layer and call it
main. This is
where we will start drawing our level. You can create this new layer by
clicking the plus icon on the top right of the screen next to the Layers
When a new layer is created, its bounding box will be displayed showing the borders of the layer. You can’t draw tiles outside of this box. This is based on the layer’s dimensions, which are configured as part of the layer’s properties. Here is a summary of what each property represents:
This is the name of the layer. It can be anything you want.
This is the path to the Tileset image file you want to use for this layer. Clicking on this property will bring up a list of directories in your project file.
This represents the size of each tile in your sprite sheet. By default, it is set to 8.
This represents how large the layer is. By default, it is set to 30×30 tiles. Since tiles are set to 8 pixels by default, this layer is 240×160 pixels.
This is the distance from the camera, similar to Z index in HTML. This is useful for background layers you want to scroll at a different speed than the foreground layers to create a parallax scrolling effect.
This toggle allows you to use the layer for collision detection, which we will cover later on.
This will pre-render your map, which can help increase the performance of your game, especially on mobile devices, but you will not be able to have animated tiles.
This is also a background layer property that allows you to repeat your layer when it scrolls by in the background. Think of this more as a texture that is repeated inside of the layer.
Now we are ready to make our first level. Let’s click on the Tileset
field and select our map tiles. After clicking on the Tileset input field,
you should see the root directory of your project from a drop-down menu,
as seen in Figure 4-3.
Select media, and there you can select
dorm-tiles.png. You will also need to set the
Tilesize to 16. Make sure to apply the changes so your selections are
Now, click inside the map editor and press the space bar to bring up the tile painter (Figure 4-4).
The tile painter is very easy to use. While your tile set is visible, simply select the tile you want to use by clicking it with your mouse. The tile set will disappear and you will now be able to place your selected tile by clicking anywhere in the layer. You can also click and drag to create many tiles of the same artwork. When you want to change tiles, press the space bar again, select a new tile, and resume clicking to place the new tiles.
Notice the yellow box at the beginning of your sprite sheet that looks empty? Selecting this allows you to erase tiles you have already painted. Weltmeister automatically creates the empty tile for you so you don’t need to add it to your sprite sheet. Let’s draw the foundation of our level, shown in Figure 4-5.
When you start creating your own level, feel free to experiment with the tiles and add some variety to your textures. You don’t have to follow this example 100%, but I wanted to create something that was quick to make and had two different ground heights to it. It’s also important to note that I never start my maps at exactly 0,0, in case I need more space at the top of the lefthand side later on.
I know this level doesn’t look very exciting yet but, don’t worry, we will get into more complex level creation later on.