How do I make it check if a key is NOT pressed? Like after releasing a key.
if (!Key.isDown(keyCode)) {}
Are you serious? That’s all? What does this ! in front of the code do?
Also my bullet freezes after I let go of the spacebar. I’m using code from the crab/How to fire tutorial. http://www.kirupa.com/developer/mx/fire.htm
here’s my code
bullet is the bullet MC
circle is the hero MC (or crab)
onClipEvent (load) {
this._visible = 0;
if (_root.fire == 1) {
this._x = _root.circle._x;
this._y = _root.circle._y;
}
}
onClipEvent ( enterFrame){
if (Key.isDown (Key.SPACE))
{
_root.fire = 1;
_root.i += 1;
duplicateMovieClip(_root.bullet, “bullet”+i, i);
if (_root.fire == 1) {
this._x -= 20;
this._visible = 1;
}
if (this._x<0) {
this.removeMovieClip();
}
if (!Key.isDown (Key.SPACE))
{
_root.fire = 0;
}}
“!” just means a negation of something…