# Stop

**URL:** <https://forum.kirupa.com/t/stop/197571>\
**Category:** Uncategorized\
**Created:** [August 17, 2006, 2:36pm UTC](https://forum.kirupa.com/t/stop/197571 "2006-08-17T14:36:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mario\_hater](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@mario\_hater](https://forum.kirupa.com/u/mario_hater)\
**Post date:** [August 17, 2006, 2:36pm UTC](https://forum.kirupa.com/t/stop/197571/1 "2006-08-17T14:36:39Z")

</div>

i made this code up for a game i am making:

```auto
onClipEvent (load) {
 moveSpeed = 10;
 mdirection = 0;
}
onClipEvent (enterFrame) {
 if (Key.isDown(Key.RIGHT)) {
  this._x += moveSpeed;
  mdirection = 1;
 } else if (Key.isDown(Key.UP)) {
  this._y -= moveSpeed;
  mdirection = 4;
 } else if (Key.isDown(Key.DOWN)) {
  this._y += moveSpeed;
  mdirection = 2;
 } else if (Key.isDown(Key.LEFT)) {
  this._x -= moveSpeed;
  mdirection = 3;
 } else {
  mdirection = 0;
 }
 if (this.hitTest(_root.block_mc)) {
  if (mdirection == 1) {
   _x -= moveSpeed;
  }
  if (mdirection == 2) {
   _y -= moveSpeed;
  }
  if (mdirection == 3) {
   _x += moveSpeed;
  }
  if (mdirection == 4) {
   _y += moveSpeed;
  }
 }
}

```

does anyone know how to simplify it of a different method of doing it because i thought i saw a different way somewhere else ?
