- Home /
Duplicate Question
CS1525 : Unexpected symbol 'hbLength'
Hi i was making a health bar script and i got this error when i was done it would be really nice if someone could just help me out on this one and solve my problem please script has been a pain for me
c#
using UnityEngine;
using System.Collections;
public class playerhealth : MonoBehaviour {
public int currentHealth;
public int maximumHealth = 100;
public float hbLength;
// Use this for initialization
void Start () {
currentHealth = maximumHealth
hbLength = Screen.width / 2;
}
// Update is called once per frame
void Update () {
ChangeHealth (0);
}
void OnGUI () {
GUI.Box (new Rect(10, 10, hbLength, 30), currentHealth + " / " + maximumHealth);
}
public void ChangeHealth (int health) (
currentHealth += health;
hbLength = (Screen.width / 2) * (currentHealth / (float)maximumHealth);
}
}
You are missing a ';' at the end of line 13 and the '(' should be a '{' at the end of line 28.
it would be really nice if someone could just help me out on this one and solve my problem please script
If you are asking someone to rewrite this script for you so that it works as a health bar, that is not what Unity Answers is all about. Unity Answers addresses single specific technical questions to help you write your own scripts.
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Rect Following Object : Unity3d 1 Answer
Enemy Health Help 1 Answer
Not identifying the collider? 2 Answers
health problem 1 Answer