I don't know what went wrong.This problem has been bothering me for nearly 2 days.Is there a god who can help me?
When running the test "health" "set_health" "this.health" value becomes "5"
public class stats : Node
{
[Export] private int Max_Health=8;
public int health;
public int set_health
{
get { return health; }
set
{
this.health=value;
GD.Print(set_health);
GD.Print(health);
GD.Print(this.health);
if (set_health<=0)
{
EmitSignal(nameof(nohealth));
}
}
}
public override void _Ready()
{
health=Max_Health;
GD.Print(health);
}
[Signal] delegate void nohealth();
}