# Platformer Question: knockBack/invulnerability

**URL:** <https://forum.kirupa.com/t/platformer-question-knockback-invulnerability/218024>\
**Category:** programming\
**Created:** [March 4, 2007, 10:56am UTC](https://forum.kirupa.com/t/platformer-question-knockback-invulnerability/218024 "2007-03-04T10:56:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rochtor](https://avatars.discourse-cdn.com/v4/letter/r/8e7dd6/32.png) [@Rochtor](https://forum.kirupa.com/u/Rochtor)\
**Post date:** [March 4, 2007, 10:56am UTC](https://forum.kirupa.com/t/platformer-question-knockback-invulnerability/218024/1 "2007-03-04T10:56:43Z")

</div>

I gotta say that platform tutorial is quite awesome! I used the majority of with great success. But that being said I do have question, a million questions really, but I’ll stick with this one.

After making contact with an enemy or obstacle, instead of instantly displacing the character, I was wondering how I might actually have a the enemy knockback the character a set amount. Also to have the character become invunerable for a period of time afterward.

I can post the FLA if it’s needed.

My theory is, and I’ve tried with no success, to have the enemy have something like

if (this.hitTest(\_root.hero.hitBody) && !dead){  
\_root.hero.damage = true;  
}

Much like the death thing, then on the hero have something like:

if(damage){  
speed+=knockBack;  
gotoAndPlay(“damageFrame”);  
}

something close to that anyway.

Any help would be greatly appreciated.
