EECS 494 Metroid Tutorials

Tile Placement

Before we can begin setting up our player, we need to set up our basic environment. In the case of Metroid, this means getting all of the tiles into our scene.

Traditionally, students would be required to painstakingly place every tile in their classic game by hand. Thankfully we have developed some editor tools to do this for you.

These editor tools can be found under the 494 dropdown at the top of your editor (they came with the unity package!)

Dropdown

Running the “01-ParseAndGenerateMap” Script

The first script that we’ll be using is 01-ParseAndGenerateMap. As the name suggests, this script is going to do most of the work in generating the map.

To begin, open the 494 dropdown and click the name “01-ParseAndGenerateMap” to open the window.

Next we need to supply arguments in the window before the script will run.

Parameters

Finally hit run and after a few seconds you’ll see your scene fill with tiles. You may need to move your scene camera: double-click the Level Game Object in your hierarchy.

PostScript

Results of the Script

Now let’s analyze the results of this script. First let’s look at the new Assets that were created in the “_GenerateAssets” folder.

NewAssets

TileSpriteSheet.png: Is a texture that was generated by the script. It serves as a Sprite Sheet that all of the Tile objects are linked to for display.

SpriteSheet

Tile_NONE.prefab: Is a prefab that all of your tile Game Objects in your scene are instances of.

TilePrefab

Room.prefab: Is a prefab for Room Game Objects. Right now all rooms do is hold your tiles, but in the future it will also hold collectables, hold enemies, and possibly manage room transitions.

RoomPrefab

Now that we understand the assets created let’s look at the hierarchy and scene view.

Hierarchy

In your hierarchy you’ll notice a single empty Level GameObject. This is mostly just for organization so that the content of your level stays separate from other things like UI or Game Managers that you’ll be adding later.

Next we have all of our Rooms. Right now these just holds the tiles, but as you add enemies and collectables make sure they go under the correct room!

And within each of these Rooms you’ll see all of the tiles. Each tile is a separate Game Object that currently just has a SpriteRenderer component.

Conclusion

Everything looks good, but unfortunately these tiles don’t actually have any properties, no collision or anything! You can observe this by dropping in the EECS-494 funball and using the arrow keys to try to bounce off the walls; the ball goes straight through them!

FunBall

Next we’re going to add some basic properties, but first…

It’s important to note that what this script did could have been done by hand. There is nothing special about the scene at this point, and you can make any changes you see fit to the scene.

Finally, note that this script should only ever need to be run once.

In the next section we’ll be adding properties to many of the tiles. When you’ve committed your changes and are ready, click here to go to the next section: 04-Configuring Tiles!