Well the problem is: I have been following the Hack and Slash Tutorial, i'm at Health Bar 2/2, but there is a problem with my Scrip, get the following errors:
Error 1 Only assignment, call, increment, decrement, and new object expressions can be used as a statement C:\Users\Zelda-Maniack\videogame\game1\OrbS\Assets\Scripts\PlayerHealth.cs 31 21 OrbS
Error 2 ; expected C:\Users\Zelda-Maniack\videogame\game1\OrbS\Assets\Scripts\PlayerHealth.cs 31 21 OrbS
Both of them are in the same line and in the adj statement:
curHealth ++ adj;
Here is the script, When i delete that line all the errors disappear.
using UnityEngine;
using System.Collections;
public class PlayerHealth : MonoBehaviour
{
public int maxHealth = 100;
public int curHealth = 100;
public float healthBarLenght;
// Use this for initialization
void Start ()
{
healthBarLenght = Screen.width / 2;
}
//Update is called once per frame
void Update()
{
AddJustCurrentHealth(0);
}
void OnGUI()
{
GUI.Box(new Rect(10, 10, healthBarLenght, 20), curHealth + "/" + maxHealth);
}
public void AddJustCurrentHealth(int adj)
{
curHealth ++ adj;
healthBarLenght = (Screen.width / 2) * (curHealth /(float)maxHealth);
}
Please help me I'm getting a little desperate XD.