Hi guys!
I’m looking for a tip how to make a death script.
I mean when I tap the screen(That will be clickergame) and mob have 0 hp then he die and resp next.
My problem is in code.
Take a look:
if (current_hp_mob < 0) {
current_hp_mob = constant_hp_mob;
Click.gold += gold_per_mob;
int i = Random.Range (0, enemies.Length);
enemies [i].SetActive (true);
a = i;
}
else
{
if ( current_hp_mob < 1 ) {
enemies [a].SetActive (false);
}
So when I have ‘tap_dmg’ = 1 then all is right. But when I have tap_dmg = 2 is’nt.
I know because. Because when hp is = 1 so simple math, 1 - 2 = -1, and mob are ‘hiding after death’ when is <1 but when <1 and <0 no.
Have you any tips? I dont want done code, just a simple tip. ![]()