# hitTest issues

**URL:** <https://forum.kirupa.com/t/hittest-issues/223039>\
**Category:** flash\
**Created:** [April 18, 2007, 11:39pm UTC](https://forum.kirupa.com/t/hittest-issues/223039 "2007-04-18T23:39:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BetaWar](https://avatars.discourse-cdn.com/v4/letter/b/e79b87/32.png) [@BetaWar](https://forum.kirupa.com/u/BetaWar)\
**Post date:** [April 18, 2007, 11:39pm UTC](https://forum.kirupa.com/t/hittest-issues/223039/1 "2007-04-18T23:39:05Z")

</div>

I am wanting to create a console game of sorts, however am having problems with the left and bottom sides of blocks (used as walls). I am wanting it to be so you can be next to the walls and move along them (which is working with right and down, but not with left and up.

Here is the AS code I am using:

```auto
onClipEvent(enterFrame){
 if(_root.Paused==0){
  if(Key.isDown(Key.UP) && this._y>5 && !_root.stage.wall.hitTest(this._x, this._y, true)){
   this._y -= _root.StepDist;
  }
  if(Key.isDown(Key.DOWN) && (this._y+this._height)<195 && !_root.stage.wall.hitTest(this._x, this._y+10, true)){
   this._y += _root.StepDist;
  }
  if(Key.isDown(Key.RIGHT) && (this._x+this._width)<195 && !_root.stage.wall.hitTest(this._x+15, this._y, true)){
   this._x += _root.StepDist;
  }
  if(Key.isDown(Key.LEFT) && this._x>5 && !_root.stage.wall.hitTest(this._x, this._y, false)){
   this._x -= _root.StepDist;
  }
 }
}

```

Attached is the full file, so you can see what it is acting like.

Any help on getting this right would be wonderful. 🙂
