TriDungeons Dev Blog #1

So I started out on an adventure to learn how to make a game. I haven’t had any previous experience with any components, engines, or scripting for games, so I wanted to start simple and use a preexisting engine. With that I limited my choices to Unreal and Unity. As someone who is a bit stronger in C# than C++, I ended up opting for using Unity over the two. And with that, I started my adventure!

The Learner Project: A Zelda Clone

Growing up, I lived off of classic Legend of Zelda games for the NES, SNES, and N64 and put in hundreds of hours in playing them again and again. So this learner project will be a Zelda clone of the classic Legend of Zelda for the NES. I’ll try to cover what areas I was covering, what problems I encountered regardless of their complexity, and some “gotchas” if I remember them.

Starting with a simple room

First things first, I started off with a small room that featured a push-able block, a key to unlock the door, and the door itself.  First things first was the tile mapping features in Unity.

The sprite editor built in to unite to slice a sprite sheet easily.
Tile Palette – This tool is what you use to paint/draw your scene!

Having never dealt with sprite this way before, this was quite the challenge! Veteran game designers will probably either laugh hysterically or be floored by this trivial feature being a road block for me but… yeah.  As it happens you first need to import your sprite sheet. This can be a number of formats, I personally chose PNG. My sprite sheet was obtained from opengameart.com (a fantastic resource! Bookmark it!). After importing the sheet, open it up in the sprite editor. From here you can choice auto splicing, grid splicing, or custom splicing. For my project I chose a 16×16 grid splicing. Once you do this, THEN you can drag and drop your sprites into the tile palette and start painting your scene. Again… trivial problem, trivial solution. It stumped me for nearly 2 days.

Next up was putting in my player object and attaching a script to control the player. This is a super simple task and probably the equivalent of “Hello, world!” in games. I also tinkered with 2D box colliders so that the player Rigidbody could be prevented from walking off the scene. The end result…

1
2
3
4
5
6
{
	if (Input.GetAxisRaw("Horizontal") > 0.5f || Input.GetAxisRaw("Horizontal") < -0.5f) { transform.Translate(new Vector3(Input.GetAxisRaw("Horizontal") * speed * Time.deltaTime, 0f, 0f)); } if (Input.GetAxisRaw("Vertical") > 0.5f || Input.GetAxisRaw("Vertical") < -0.5f)
	{
		transform.Translate(new Vector3(0f, Input.GetAxisRaw("Vertical") * speed * Time.deltaTime, 0f));
	}
}

After this I wanted to play around with scripting objects and triggers. This led to getting the first key to spawn in the room and the player getting the ability to open locked doors.

This little ditty involved a box collider around the key that served as a trigger. Once the player runs into the box collider the key is “picked up” by the player, though in the code its just set to inactive and garbage collected from the game. At this point I was getting a bit excited and wanted to show my little demo of the game so far. It dawned on me that I should assume my viewers no nothing about how the game works. So I backpedaled a little bit and took a short dive into the Unity UI feature set. The only thing different here is that I added text that changed based on the events that already existed in code. Keys are also tracked as well which was a nice quick add toward the end.

So in summary, this involved BoxCollider2D, RigidBody2D, movement scripting, and using the sprite editor and tile palette tools. So little of the game has been completed and yet so much has been learned so far. Its been insane. Thats all she wrote now folks!