For the next series of articles, as I continue fleshing out the platformer layout, I’ll be looking at a new game. This new game is going to be a mobile based adventure game. To get started, we are going to take a look at TileMaps within unity and see what they are all about.
The Tilemap system makes it easy to create and iterate level design cycles within Unity. It allows the rapid prototyping of 2D worlds. It consists of a grid overlay along with other components that work together. It allows us to just tiles and brushing tools to define how the tiles behave and create platforms with dynamic edges, animated, randomized placement and more.
To start, we will create the tilemap within our hierarchy:
From here we will want to create a new palette to work with:
As we are going to be working with multiple layers, we will want to be able to slice up the asset we have into multiple pieces:
From here, we are going to sets our asset up to the amount of pixels per unit that we will require:
Once we have it all set up, it will create individual tiles in the aspect ratio that we set it as:
From here, we drag it into our tile palette that we created and create a new folder for it to be saved in.
As for shading in our tiles, we have multiple means at doing that:
The white square designates the camera’s view. As for methods that we can use, there is either individual squares, a block section you drag over, or filling of an area. As for getting rid of the blocks, you can just use the eraser to delete them.
What we can also do is select a grouping of tiles to paint onto our scene at once:
When creating palettes, we are not limited to just 1 set of assets at a time. We can place in multiple assets to a palette and we can move it around on the palette to places that we find best suited for use:
Now, when creating our scenes image, we will want to work in layers so that there are parts of the background that give us the image of something is there, but not allow our character to interact with it:
In order for us to prevent the un-interactable background from overlapping our scene, we simply have to adjust the sorting layer.
Now, when we go about placing the various parts to our scene, we can change the view we are getting so that we can focus on just that part of the tilemap when designing, or we can move over to it to erase any excess stuff we place on the scene:
When playing with something like vegetation, we will want to have it resting on top of the floor without any small gaps between it all. To do so, we can simply just alter the transform of the whole tilemap:
Now that we have a good basic understanding on how we can utilize tilemaps, we can can now build ourselves a scene to work with.