Posts

Showing posts from April 26, 2018

Unity Project 6: Health Bar

Image
Scene view When the player collides with the spike trap, their health is decreased by 10. Gameplay The max health and health is defined.  When the player collides with the spike trap the health bar's foreground (Red colour) is decreased by 10. Health bar inspector

Unity Project 6: Particles

Image
Particle system acting on the coin Setting the values for the particle system allowed us to cause an explosion type effect with the coin when collected by the player. Looping was unchecked so that the particle system was only activated when triggered by the player. Other elements were also changed such as the colour of the particles so that they matched the colour of the coin. Particle system gameobject

Unity Project 6: Coin Collection

Image
Standard assets imported from the asset store so that we could use an FPS controller. Standard assets Coin Gameplay Scene view Invisible enemy (Spike)  'Spike Trap' script attached so that when the player collides with the spike trap, an object can be triggered or an event can occur (such as. losing health). Enemy Inspector The 'Pick Up' script is attached to the coin object. Coin Inspector Outer mesh of the coin has an 'Idle Move' and 'Constant Rotation' script attached, allowing the coin to move up and down on the spot as a type of animation. Outer Mesh of Coin Inspector Assets Hierarchy

Unity Project 5: Opening Doors (Code Explained)

Image
This script opens and closes the door panel by setting the boolean value in the animator panel to true or false depending on whether the conditions fit whether the door needs to be open or closed. If the conditions for either are met, either the open or closed animation for the door is played in the game. DoorOpenClosed script This script works based on whether the player has collided with the door or not. If the player has the door open animation is triggered, if they have not the door continues to be closed or the door close animation is triggered by setting the boolean value to either true or false. DoorOpenForPlayer script

Unity Project 5: Opening Doors

Image
Scene view Animator panel, where you can create a motion path for the door to open and close. Animator panel Connected nodes which tell you whether the door is open or closed based on a boolean decision. Door is open Door is closed Gameobject with an animator component, that allows the door panel to be animated and has the 'DoorOpenForPlayer' script which opens the door when the player is in close proximity to the door. Door frame inspector When the player is in close proximity to the door, the door opens. Door opened Door closed, as the player is too far away from the door for it to be open. Door closed Hierarchy Parameter 'IsOpen' (Boolean) is unchecked so that the door begins closed as it isn't open otherwise the door would be open. Parameters The 'Loop Time' box needs to be unchecked on the animated asset otherwise the door will continuously open and close. This looping isn't needed as