# Moving Character and Ground

**URL:** <https://forum.kirupa.com/t/moving-character-and-ground/224614>\
**Category:** programming\
**Created:** [May 3, 2007, 7:28pm UTC](https://forum.kirupa.com/t/moving-character-and-ground/224614 "2007-05-03T19:28:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![seraphimglobal](https://avatars.discourse-cdn.com/v4/letter/s/8491ac/32.png) [@seraphimglobal](https://forum.kirupa.com/u/seraphimglobal)\
**Post date:** [May 3, 2007, 7:28pm UTC](https://forum.kirupa.com/t/moving-character-and-ground/224614/1 "2007-05-03T19:28:21Z")

</div>

Hello,

I have what I think is an easy question. I am making a game with a character that you move using the arrow keys. When he gets to a certain point in the window I want the ground underneath to start moving down. The code below works but the character gets stuck in ground moving only and can’t move independently again. If I trace this.\_y I get 146 when he gets stuck. I tried a little code that would kick him back outside of that but it looked awful.

```auto

if (Key.isDown(Key.UP)) {
        if (this._y>150) {
//Move the character
            this._y = Math.max(this._y-distance, 0);
        } else {
//Move the ground down stage
            _root.ground._y += 8;
        }

else if (Key.isDown(Key.DOWN)) {
        if (this._y>150) {
//Move the Character
            this._y = Math.max(this._y-distance, 0);
        } else {
//Move the ground down up
            _root.ground._y -= 8;
        }
}

```

I appreciate any help you can provide.
