Skip to main content

UNITY TUTORIAL 06

In this weeks tutorials I learned how to add UI to my game to show Ruby's health status using images. I created a canvas in my hierarchy then created an image as a child gameobject. I added the health bar background image into the image gameobject's source image. I clicked the 'set native setting'' button so the image would transform into its original size. The image became very big so I resized it to fit into the top left corner of the game scene. I chose the anchor preset in the rect transform section of the inspector so that the anchor would reposition into the top left corner. This makes sure that the UI stays in that corner at al times. 

I created a child object to the health bar image and added a Ruby portrait into the source image, then resized it to fit into the circle. I made another child object of the health bar background and called it mask, resized the white box, and adjusted the anchors to each of its corners. I added the blue health bar image and resized it, then applied a mask component and unchecked 'show mask graphic' so that the white box would become hidden. I edited the code so that the bar would reduce when Ruby takes damage. 

I added a new character called Jambi as an npc and edited its code so Ruby is able to interact with them. I gave Jambi a dialog box and applied some text that they would say. I then adjusted the code so that the dialog box would appear when Ruby interacts with Jambi.  

Screenshot of my work in Unity.

Comments

Popular posts from this blog

FIRST PLAYABLE

Continuing with the creation of my game, I resized the player character to make them even smaller based on a comment that was left on my last project blog. I also repositioned the trees to make the space slightly narrower and added some flowers to bring some colour into the scene. With reference from the animal feeding game tutorial, I was able to get the player moving left and right by clicking the arrow keys. I brought in rocks and a branch for obstacles but I need to apply a SpawnManager script and get them to spawn randomly during gameplay. I also have to figure out how to get some branches falling from the trees and bringing in power-ups and points too. Screenshot from Unity3D of my game production.

PROTOTYPE

I browsed through the Unity asset store to find a package with nature objects that I could use to set up the scene for my infinite runner game. I downloaded the Nature Starter Kit 2  and started building my scene in Unity. This was a little time consuming but I'm satisfied with the way it turned out. I upscaled the trees and bushes, keeping in my mind my initial idea of gaining inspiration from the movie "The Secret World of Arrietty." I got the character from a tutorial I have completed for this module before and positioned the camera behind it. Screenshot of my work in Unity3D. With reference to the lesson 3 Unity tutorial, I started coding by creating the PlayerController script. I used the AddForce method and allowed the player to jump by clicking the spacebar. I declared two public variables to be able to adjust the gravity and player's jump force. Looking into the player's animator controller, I applied a static running animation. I then added a jumping ani...