# Diagonal Keyboard Movement

**URL:** https://forum.kirupa.com/t/diagonal-keyboard-movement/147175
**Category:** Uncategorized
**Created:** [May 7, 2005, 10:44pm UTC](https://forum.kirupa.com/t/diagonal-keyboard-movement/147175 "2005-05-07T22:44:52Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![chilldog](https://avatars.discourse-cdn.com/v4/letter/c/7cd45c/32.png) [@chilldog](https://forum.kirupa.com/u/chilldog)
#### Post date: [May 7, 2005, 10:44pm UTC](https://forum.kirupa.com/t/diagonal-keyboard-movement/147175/1 "2005-05-07T22:44:52Z")

</div>

I’m trying to get the characters in this Flash game to move diagonally - it works, but the following occurs:  
[list=1]  
[_]The character is walking **[size=4]twice[/size]** as fast as it does when going [size=1]left, right, up, down[/size]  
[_]The walking animation _doesn’t_ play  
[/list]

```php

onClipEvent (load) {
walkSpeed = 3;
stop();
}
onClipEvent (enterFrame) {
if (Key.isDown(key.DOWN)) {
_y += walkSpeed;
this.gotoAndStop(1);
}
if (Key.isDown(Key.UP)) {
_y -= walkSpeed;
this.gotoAndStop(2);
}
if (Key.isDown(key.LEFT)) {
_x -= walkSpeed;
this.gotoAndStop(3);
}
if (Key.isDown(key.RIGHT)) {
_x += walkSpeed;
this.gotoAndStop(4);
}
if (Key.isDown(Key.LEFT) & Key.isDown(Key.UP)) {
this.gotoAndStop(5);
_x -= walkSpeed;
}
if (Key.isDown(Key.RIGHT) & Key.isDown(Key.UP)) {
this.gotoAndStop(6);
_x += walkSpeed;
}
if (Key.isDown(Key.DOWN) & Key.isDown(Key.LEFT)) {
this.gotoAndStop(7);
_x -= walkSpeed;
}
if (Key.isDown(Key.DOWN) & Key.isDown(Key.RIGHT)) {
this.gotoAndStop(8);
_x += walkSpeed;
}
if (!Key.isDown(key.UP) & !Key.isDown(key.DOWN) & !Key.isDown(key.LEFT) & !Key.isDown(key.RIGHT)) {
this.gotoAndStop(9);
}
}
 

```

Can someone show me the way?
