Help! AI interaction problem!

I am currently making a simple game to be a base for further projects. Here is a demo:


If you notice, when moving, if you touch an enemy, you can hear a scream (meaning the character registers a hit test and should die). The character does not die because the die frames are being overridden by a Key.isDown command telling it to move, therefore you hear the scream for the first die frame and he continues to walk. How would you fix this? This also happens when shooting (spacebar).

Also, how would you rig it so that you can only shoot after each time the gun reloads? (If you stand still while shooting, he pumps the shotgun)

If you actually want to give the code, use the character instance as “spaceship” (former name, haven’t changed yet), enemy as “enemy1”, and bullet as “laser”.

Thanks for any help given, I appreciate it.