Game problem

Hello. :slight_smile:

Well I am making this ship game right and when You press the left button.

[AS]onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
this._x -= 5;
this.gotoAndPlay(2);
}
}
[/AS]

It will go left and play an animation but see I want the animatyion to work As I press left the animation It only works after I am done pressing it please help me.

You should know by now that Random is not the place for Flash questions :evil:

Opps I didnt know I put it in there

just a guess…

if (Key.isDown(Key.LEFT)) {
this._x -= 5;
if (!this.l) this.gotoAndPlay(2);
}
this.l = Key.isDown(Key.LEFT);

??

It WOrks!!!

Questions:

What does ! mean its in the code
and also what does this code do

this.l = Key.isDown(Key.LEFT);

! (logical NOT)

Key.isDown returns a Boolean (true/false), it simply assigns that Boolean to this.l, which will be evaluated by the if action.