# WSAD Character Movement Question

**URL:** <https://forum.kirupa.com/t/wsad-character-movement-question/311581>\
**Category:** programming\
**Created:** [July 11, 2010, 3:39am UTC](https://forum.kirupa.com/t/wsad-character-movement-question/311581 "2010-07-11T03:39:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![plablugoo](https://avatars.discourse-cdn.com/v4/letter/p/54ee81/32.png) [@plablugoo](https://forum.kirupa.com/u/plablugoo)\
**Post date:** [July 11, 2010, 3:39am UTC](https://forum.kirupa.com/t/wsad-character-movement-question/311581/1 "2010-07-11T03:39:43Z")

</div>

Is there a way to allow the player to control the character with WSAD and the arrow keys in this code?

```auto
 
k.onKeyDown = function() {
 target.onEnterFrame = mover;
 var k = Key.getCode();
 if (k == Key.UP) {
  target.yspeed = -3;
  target.xspeed = 0;
  target.gotoAndStop(2);
 } else if (k == Key.LEFT) {
  target.yspeed = 0;
  target.xspeed = -3;
  target.gotoAndStop(2);
 } else if (k == Key.DOWN) {
  target.xspeed = 0;
  target.yspeed = 3;
  target.gotoAndStop(2);
 } else if (k == Key.RIGHT) {
  target.yspeed = 0;
  target.xspeed = 3;
  target.gotoAndStop(2);
 } else if (k == Key.SHIFT) {
  target.yspeed = 0;
  target.xspeed = 0;
  target.gotoAndStop(3);
 }
};
Key.addListener(k);

```
