Friday 1 April 2016

Coding - Golem Health, Death and Emission - John Howard

Task
Code health and a diagetic emission health bar.
Step One - Setting up the materials
The first step was to take Tom's latest model and apply the materials and latest rig. This was a very quick script to set up.
Step Two - Accessing Emissions
Accessing the emission texture took more work than I thought to begin with. It turns out you have to actually call keywords to unlock the use of them. I had to refer to this API quite a lot in order to get it working. But once I did it was rather simple. I could now change the emission to be that of a set colour. I then decided to create a point light which would take its colour value from the emission and would have a pulse script on it. This made it feel more alive.
Step Three - Health
I then set up a health script which used cur-health and max-health. The current health could be accessed by a trigger which would lower the current health. I set this up to make use of the emssion. So as the golem's health falls its light changes.
  • 180 - 121 -- Yellow
  • 120 - 61 -- yellow/orange
  • 60 - 41 -- orange/red
  • 40 or less -- red
This allows a proper diagetic showing of the health. So the player can read what is happening in game.


Step Four - Death
Once that reaches 0 the golem activates a death animation and falls to the ground. Where it plays a death sound then is destroyed and a hollow armor is instantiated in place, made by jack. This was just instantiating and calling bools so a very simple script to make.


No comments:

Post a Comment