The problem with the healthbar before is that when the health would be reduced, the health bar would disappear from the screen. To look into this bug, I created a GUIText that would print the health to the screen. Sure enough, the health went down to the current value but the health bar still disappeared. I then printed the value of the healthbar width to the screen, and when health decreased, the width value went from 225 to 0.
I printed the formula (health / maxHealth) to the GUIText next, which went from a value of 1 to 0. From this, I could tell that the problem was caused by this conversion. By changing the type of health and maxHealth from integers to floats, this solved the problem.
I have also changed the health system so that instead of health decreasing passing through a waypoint, that colliding with a tree deduces it instead. However, I was unable to implement it so that every tree in the track reduces damage (since they are not gameobjects) but I have placed one tree in the track (tree sticking out on inside of first corner) since this tree is a gameobject.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment