# Game magic?

**URL:** <https://forum.kirupa.com/t/game-magic/187745>\
**Category:** programming\
**Created:** [May 2, 2006, 1:33am UTC](https://forum.kirupa.com/t/game-magic/187745 "2006-05-02T01:33:42Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leo\_The\_CRaZeD](https://avatars.discourse-cdn.com/v4/letter/l/898d66/32.png) [@Leo\_The\_CRaZeD](https://forum.kirupa.com/u/Leo_The_CRaZeD)\
**Post date:** [May 2, 2006, 1:33am UTC](https://forum.kirupa.com/t/game-magic/187745/1 "2006-05-02T01:33:42Z")

</div>

I have run into a problem: The ground I am using in my game has a BRUSH ground. But my code I have only supports boxes! I have the code applied to the main person…

```auto
 
onClipEvent (load) {
    y = jump=0;
    _root.point=0;
    death=false;
    _root.hp=100;
    speed = 5;
    hold=0;
    control=false;
    move=1;
}
onClipEvent (enterFrame) {
    xmax = this.getBounds(_root).xMax;
    xmin = this.getBounds(_root).xMin;
    ymax = this.getBounds(_root).yMax;
    if (Key.isDown(Key.RIGHT) && !_root.ground.hitTest(xmax+speed, _y, true) and move==1 and death==false and !control) {
        _xscale=100;
        gotoAndStop (2);
        _root.ground._x -= speed;
    }
    if (Key.isDown(Key.LEFT) && !_root.ground.hitTest(xmin-speed, _y, true) and move==1and death==false and !control) {
        _xscale=-100;
        _root.ground._x += speed;
        gotoAndStop (2);
    }
    if (_root.ground.hitTest(_x, ymax-(y/2), true)) {
        jump = true;
        y = 0;
    } else {
        y -= 1;
        jump = false;
    }
    if (jump && Key.isDown(Key.SPACE)and death==false) {
        if (Key.isDown(Key.CONTROL)) {
        }
        gotoAndStop(1);
        y = 13;
    }
    if (!Key.isDown(Key.LEFT) and !Key.isDown(Key.RIGHT)and death==false and !control) {
        gotoAndStop (1);
    }
    _root.ground._y += y;
    if (Key.isDown(Key.CONTROL)and death==false) {
        control=true;
        move=0;
        gotoAndStop (3);
    } else {
        control=false;
        move=1;
    }
    if (Key.isDown(Key.DOWN) and jump and death==false) {
        gotoAndStop (4);
        if (Key.isDown(Key.SHIFT)) {
            gotoAndStop (5);
        }
        move=0;
    } else {
        move=1;
    }
    if (_root.hp<=0) {
        _root.hp=0;
        gotoAndStop (6);
        _xscale=100;
    }
}

 

```

Any ideas?
