Damage script only works when moving

I have a script which causes my worm character to spin once when hit by an enemy projectile. However, he only spins if he is moving forwards, so if he is moving backwards or staying still there is no damage.

What could the problem be?

This is the damage part of my script, ask if you need to see the rest

		if(tumbleSpeed <1)
			//we're not hit anymore... reset and get back in the game
			tumbleSpeed = backup[0];
			decreaseTime = backup[1];
			decayTime = backup[2];
			gotHit = false;
		} else
			//we're hit, spin the guy around
			transform.Rotate(0,tumbleSpeed * Time.deltaTime,0, Space.World);
			tumbleSpeed = tumbleSpeed-decreaseTime;
			decreaseTime += decayTime;

Thanks :slight_smile:

You keep watching the tutorials. They will fix it.

well i made something similar to this, but it worked not as i wanted it to, but this is a better way to do this…