{Help} I Misunderstand this code

Alright, How’s Everything going on in flashkit. I hope it’s going good?.

Well I have a problem with my code and dont Understand it fully.

Alright the code.

onClipEvent (load) {
    b = this.getBounds(this);
}
onClipEvent (enterFrame) {
    if (Key.isDown(39)) {
        _x += 4;
    }
    if (Key.isDown(37)) {
        _x -= 4;
    }
    if (Key.isDown(38)) {
        _y -= 4;
    }
    if (Key.isDown(40)) {
        _y += 4;
    }
    if (!_root.hit.hitTest(_x+x+b.xmin+1, _y+y+b.ymin+1, true)) {
        if (!_root.hit.hitTest(_x+x+b.xmax+1, _y+y+b.ymin+1, true)) {
            if (!_root.hit.hitTest(_x+x+b.xmin+1, _y+y+b.ymax+1, true)) {
                if (!_root.hit.hitTest(_x+x+b.xmax+1, _y+y+b.ymax+1, true)) {
                    _x += x;
                    _y += y;
                }
            }
        }
    }
}

That’s the code. Now I was searching through goggle. And flashkit for Shape flag hitTest, and all edge’s hitest. And I found Edmacks Edblog site

Well I saw that the code was used with a function, and since My movement code is not in a function and I don’t want to change it into a function, I decided to try it myself and use the code without using a function that’s the code I came up with.

I think I understand some of the code but not enough to make it work the right way.

I attached the Fla.

Anyways the hitTest don’t work but there isn’t no errors. So im guessing it’s because I don’t understand the code and I did something wrong

  • Bulldog_Flash