# Game problem

**URL:** <https://forum.kirupa.com/t/game-problem/25377>\
**Category:** programming\
**Created:** [July 11, 2003, 11:34pm UTC](https://forum.kirupa.com/t/game-problem/25377 "2003-07-11T23:34:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![BullDog\_Flash](https://avatars.discourse-cdn.com/v4/letter/b/d07c76/32.png) [@BullDog\_Flash](https://forum.kirupa.com/u/BullDog_Flash)\
**Post date:** [July 11, 2003, 11:34pm UTC](https://forum.kirupa.com/t/game-problem/25377/1 "2003-07-11T23:34:25Z")

</div>

Hello. 🙂

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 11, 2003, 11:53pm UTC](https://forum.kirupa.com/t/game-problem/25377/2 "2003-07-11T23:53:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 11, 2003, 11:55pm UTC](https://forum.kirupa.com/t/game-problem/25377/3 "2003-07-11T23:55:32Z")

</div>

Opps I didnt know I put it in there

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 12, 2003, 12:27am UTC](https://forum.kirupa.com/t/game-problem/25377/4 "2003-07-12T00:27:24Z")

</div>

just a guess…

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

```

??

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 12, 2003, 1:11am UTC](https://forum.kirupa.com/t/game-problem/25377/5 "2003-07-12T01:11:45Z")

</div>

It WOrks!!!

Questions:

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

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

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 12, 2003, 1:28am UTC](https://forum.kirupa.com/t/game-problem/25377/6 "2003-07-12T01:28:57Z")

</div>

[! (logical NOT)](http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary007.html)

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