# Terrain moving through my guy

**URL:** <https://forum.kirupa.com/t/terrain-moving-through-my-guy/162351>\
**Category:** Uncategorized\
**Created:** [September 12, 2005, 1:30pm UTC](https://forum.kirupa.com/t/terrain-moving-through-my-guy/162351 "2005-09-12T13:30:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Duranix](https://avatars.discourse-cdn.com/v4/letter/d/ce7236/32.png) [@Duranix](https://forum.kirupa.com/u/Duranix)\
**Post date:** [September 12, 2005, 1:30pm UTC](https://forum.kirupa.com/t/terrain-moving-through-my-guy/162351/1 "2005-09-12T13:30:57Z")

</div>

Ok, now i have a bad problem.

I have the code:

> onClipEvent (enterFrame) {  
> with (\_root.player) {

```
     // Controls Player Speed
     mySpeed = 3;

     // Controls how far the Player bounces off the wall after impact
     myBounce = 3;

     // keyboard controls
     if (Key.isDown(Key.DOWN)) {
         _y -= mySpeed;
     }
     if (Key.isDown(Key.UP)) {
         _y += mySpeed;
     }
     if (Key.isDown(Key.LEFT)) {
         _x += mySpeed;
     }
     if (Key.isDown(Key.RIGHT)) {
         _x -= mySpeed;
     }

     // detect if edges of the player is colliding with the Maze Walls
     if (walls.hitTest(getBounds(_root).xMax, _y, true)) {
         _x -= myBounce;
     }
     if (walls.hitTest(getBounds(_root).xMin, _y, true)) {
         _x += myBounce;
     }
     if (walls.hitTest(_x, getBounds(_root).yMax, true)) {
         _y -= myBounce;
     }
     if (walls.hitTest(_x, getBounds(_root).yMin, true)) {
         _y += myBounce;
     }

     // detect if Maze is finished
     if (_root.end.hitTest(_x, getBounds(_root).yMax, true)) {
         _root.gotoAndStop(3);
     }
 }

```

}

and ive labeled my maze’s instance name as “player”, and my guy as “walls”, but my terrain keeps walking through my guy \>.\<‘’
