the actual script is 500+ lines long so here are some parts
this is the function for getting hit with a fireball
function FireballHit () {
health -= laserDamage * damageMultiplier * 2.5; //damage
if(blocking == 0){ //if not blocking
Instantiate(laserHitSound,transform.position,transform.rotation); //play a sound
hit = 1; //character is hit
transform.Rotate(Vector3.right * -20); //rotate backwards to make it look better
Destroy(shownMesh);// destroy the current mesh
shownMesh = Instantiate(hitMesh,transform.position,transform.rotation); // create a
//different mesh
Invoke("Unhit",3);//stop being hit (hit = 0;)
}
}
all the attacks have if(hit == 0){ at the start
when the character is hit, hit doesn’t change from 0, does anyone know the problem?