# Problem with X and Y Movement

**URL:** <https://forum.kirupa.com/t/problem-with-x-and-y-movement/154480>\
**Category:** programming\
**Created:** [July 10, 2005, 5:19am UTC](https://forum.kirupa.com/t/problem-with-x-and-y-movement/154480 "2005-07-10T05:19:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Insane\_Knux](https://avatars.discourse-cdn.com/v4/letter/i/439d5e/32.png) [@Insane\_Knux](https://forum.kirupa.com/u/Insane_Knux)\
**Post date:** [July 10, 2005, 5:19am UTC](https://forum.kirupa.com/t/problem-with-x-and-y-movement/154480/1 "2005-07-10T05:19:54Z")

</div>

I have this player, and you use the left and right arrow keys to control him.  
Well he has a running animation and this is the code:

```auto
onClipEvent(enterFrame){
    if (Key.isDown(Key.RIGHT)){
        _x += 10;
        this.gotoAndStop(2);
    } else {
        this.gotoAndStop(1);
    }
}
onClipEvent(enterFrame){
    if (Key.isDown(Key.LEFT)){
        _x -= 10;
        this.gotoAndStop(3);
    }
}

```

Well, on the Left Key Press, when you press it, he goes left, but he doesnt play his animation… why?  
Any help would be awesome! 😉
