|

Deeper Dive Inquiry Post #3: Unity (Tilemaps and Moving Platforms)

Introduction

In my last inquiry post, I created a movable player character. It was time to give them a world to explore. My goal for this post was to design a level that the player could jump through. I’m crediting the same video as last post as it’s the one I used to learn everything to create the level.

What is a Tilemap?

Before I started this project, I thought level design meant dragging individual square sprites into the scene one by one. I quickly realized that is incredibly inefficient. A Tilemap is essentially a grid-based system that allows you to paint levels using a palette of tiles. Think of it like a digital version of Lego. You create a Tile Palette, slice your sprite sheet into individual tiles, and then use a brush tool to draw your platforms directly into the 2D grid.

Why use it?

  • Efficiency: You can build complex levels in minutes rather than hours.
  • Collision Optimization: Instead of having 100 individual Box Colliders for 100 floor tiles, Unity uses a Tilemap Collider 2D and a Composite Collider 2D to create one single, smooth physical boundary for the entire floor.

How I used it:

  • Setting up the Grid: I created a 2D Object > Tilemap > Rectangular in the hierarchy.
  • The Palette: I imported a sprite sheet and used the Sprite Editor to slice it into 32×32 pixel squares.
  • Painting: I used the Tile Palette window to draw my ground layer.

The Moving Platform Challenge

I wanted some moving platforms in my level. Creating this was no easy task, the goal was to move the platform from point A to B back to A in a loop. That was the easy part of the 2 step process. The next step was to figure out how the player would stick to the platform if they were on top of it. To solve this I set the parent of the player to the platform if it was on the platform, and set it back to null if it ever left the platform.

Demonstration

Below is a video of the first level I created with the moving platforms, and me completing the level too!

Leave a Reply