Unity Tutorial 04: It's Starting to Look Like a Game!


Looking at the gem from a close distance changes the UI
This week's Unity Tutorial takes me back to the world I have created following Jimmy Vegas' Cobalt series tutorials.

I started off by editing the UI, so that when the player is close to the gem and looks at it with the crosshairs, an action command is shown telling the player how to pick up the gem. This was a simple enough process, made easier by Jimmy's very easy to follow tutorials.

As per usual, there was some C# coding to be done. I'm definitely starting to get the hang of it, and the actual logic behind the coding is beginning to make sense to me. If / else statements now seem simple, and the tags are becoming familiar. Now after inputting some code, the gem disappears when the action button is pressed, the cursor reverts to normal, and a sound chimes to indicate that the gem has been picked up.

After creating some fences, the next step was to create a weapon. Now it's starting to feel like a video game! I brought in the axe and resized it to realistic dimensions. To have the axe move with the Player, I put it with the Player Character.

The axe appears as if it is in the Player's right hand

Animation is a brand new feature for me in Unity. It adds a lot of scope to the things that can be done in the game. In this instance, I used it to make an axe swing. Using rotation and position, the axe appears to be swung towards the centre of the screen. The default is that the axe is constantly swinging, but following Jimmy's methods, he switched the code so that the axe remains in default position until the action is triggered.

With the axe being a Game Object, and walls and fences and terrain being game objects, unfortunately clipping can occur. When the player walks into the wall with the axe in front of them, the axe will go through. The same thing happens when looking at the ground. Using layers, this can be avoided, and the axe will always remain in front of the other objects in the players field of view.

I found this weeks tutorials to be really helpful. It feels like I'm getting closer to having some sort of functioning game. I'm relieved that the coding is getting more familiar. For a while it seemed as though I would never understand it. There are many things I learned today that I will definitely be using in my own game design.

- Ultan


Comments

Popular posts from this blog

Introduction: How I Became Addicted

Alpha

Game Design: What is it?