# Arrow Keys

**URL:** <https://forum.kirupa.com/t/arrow-keys/186606>\
**Category:** flash\
**Created:** [April 22, 2006, 9:03pm UTC](https://forum.kirupa.com/t/arrow-keys/186606 "2006-04-22T21:03:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![akraix](https://avatars.discourse-cdn.com/v4/letter/a/4da419/32.png) [@akraix](https://forum.kirupa.com/u/akraix)\
**Post date:** [April 22, 2006, 9:03pm UTC](https://forum.kirupa.com/t/arrow-keys/186606/1 "2006-04-22T21:03:19Z")

</div>

Im making a game that involves moving the character with the arrow keys. I want to know the code to make him be able to move move at a set speed on the X and Y axis.

Thank you

---

<div class="post-metadata">

**Author:** ![akraix](https://avatars.discourse-cdn.com/v4/letter/a/4da419/32.png) [@akraix](https://forum.kirupa.com/u/akraix)\
**Post date:** [April 22, 2006, 9:27pm UTC](https://forum.kirupa.com/t/arrow-keys/186606/2 "2006-04-22T21:27:12Z")

</div>

Okay, I have another question.

How can I make walls, or blocks that the character cannot go past.

---

<div class="post-metadata">

**Author:** ![watcher](https://avatars.discourse-cdn.com/v4/letter/w/77aa72/32.png) [@watcher](https://forum.kirupa.com/u/watcher)\
**Post date:** [April 22, 2006, 9:29pm UTC](https://forum.kirupa.com/t/arrow-keys/186606/3 "2006-04-22T21:29:54Z")

</div>

> [@akraix](#):
>
> Im making a game that involves moving the character with the arrow keys. I want to know the code to make him be able to move move at a set speed on the X and Y axis.
> 
> Thank you

```auto

this.onEnterFrame = function(){
    if (Key.isDown(Key.LEFT)) {
            _x -= speed;
     }
    if (Key.isDown(Key.RIGHT)) {
            _x += speed;
    }
}

```

---

<div class="post-metadata">

**Author:** ![watcher](https://avatars.discourse-cdn.com/v4/letter/w/77aa72/32.png) [@watcher](https://forum.kirupa.com/u/watcher)\
**Post date:** [April 22, 2006, 9:32pm UTC](https://forum.kirupa.com/t/arrow-keys/186606/4 "2006-04-22T21:32:52Z")

</div>

> [@akraix](#):
>
> Okay, I have another question.
> 
> How can I make walls, or blocks that the character cannot go past.

Check the tuts on [kirupa.com](http://kirupa.com) first …  
[http://www.kirupa.com/developer/actionscript/rpgprogramming4.htm](http://www.kirupa.com/developer/actionscript/rpgprogramming4.htm)  
[http://www.kirupa.com/developer/mx2004/platform\_game.htm](http://www.kirupa.com/developer/mx2004/platform_game.htm)

I guess reading the first tutorial would help you out just fine…
