Hello,
I am working on a 2.5D platformer and we are in the finishing stages.
However, there is a feature I never understood how to implement (it's the first time I tried coding and I have zero programming formation).
We want to have a temporary invulnerability after the character takes a hit (like in the Mario games) so that life can't be drained in a second by continuous hits.
We are using "damage" trigger zones. How could I add a condition so that the trigger is only effective if there hasn't been damage in the last X seconds?
Here is the damage script:
var sound : AudioClip;
function OnTriggerEnter (other : Collider) { if(other.gameObject.tag == "Player"){ audio.PlayOneShot (sound); LifeGUI.charge--; } }
Many thanks in advance. Please remmember that I am not a programmer, so that what seems obvious to you isn't to me! ;)