02 – Creating Level1 Map

Introduction

Now we have a project with a platformer Player entity. Next we’ll adad a Level1Map. We will be using a pre-made TMX file, but we’ll add blocks to a GameplayLayer for controlling whether the player is on solid ground, ice, or water.

Downloading the Map

The Glue Wizard created a Map in our Level1 screen, which is useful if we were going to make our levels from scratch. Instead, we’ll use a TMX file to speed things up. Download the following three files to the same folder (such as your downloads folder):

Replacing the Existing Map

Our game already contains a file named Level1Map.tmx – this is the default name of the TMX added to our Level1 Screen. We can replace this file on disk with the downloaded file. We need to remember to also copy over the other two files. To do this:

  1. In Glue, expand Level1 Files
  2. Right-click on Level1Map.tmx
  3. Select View in explorer to open the containing folder

Once open, drag+drop the three downloaded files into the Level1 content folder. If asked, replace the existing file.

Now our game will run and display the level, but our character still falls through the screen. We’ll fix this next.

Adding Collision Tiles

Our Level1Map.tmx file currently contains only visuals. We’ll add a gameplay layer and tiles to the gameplay layer so that our character can collide with the ground.

To do this:

  1. Double-click the new Level1Map.tmx – either in the file explorer or in Glue
  2. Return to Glue and click the Folder icon to open the project folder
  3. Open the Content folder
  4. Drag+drop the StandardTileset.tsx in the Content folder onto Tiled to access this tileset in Level1Map.tmx
  5. Add a new layer to the map called GameplayLayer
  6. Outline the solid collision areas in the level using the top-left brick tile to mark the SolidCollision tiles. Be sure to place these tiles on the GameplayLayer

  7. Use the water tile and paint over the water area of the map. Again, be sure to place these tiles on the GameplayLayer

  8. Finally, place ice tiles over the ice collision (the blue platforms) on the GameplayLayer

Conclusion

Now our player can collide with the solid ground, but will not collide with ice or water yet.

On the next tutorial we will set up our ice and water blocks to collide with the player and set the correct movement values.