using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HD {
public int health;
{
// Start is called before the first frame update
void Start()
{
DamagePlayer(10);
}
// Update is called once per frame
void Update()
{
if (health <= 0)
{
Debug.Log("The player has died! health" + health);
}
else if (health >= 15)
{
Debug.Log("You have a lot of life");
}
}
void DamagePlayer(int damage)
{
health -= damage;
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class HD {
public int health;
{
// Start is called before the first frame update
void Start()
{
DamagePlayer(10);
}
// Update is called once per frame
void Update()
{
if (health <= 0)
{
Debug.Log("The player has died! health" + health);
}
else if (health >= 15)
{
Debug.Log("You have a lot of life");
}
}
void DamagePlayer(int damage)
{
health -= damage;
}
}
Remove the extra opening curly brace under the “health” field.