Box Pushing in AS2

I’m trying to make my character push a box, but all the box is doing is sticking onto the character. I know why it’s doing it, I just don’t know how to fix it.

code:


if(this.hitTest(_root.char)){
_x += _root.xSpeed;
}else{
_x += 0;
}


Help is much appreciated

Why is it doing it?

i tell it when the character is touching it, move xSpeed. the problem is that if the char is moving the opposite direction, the box will stick with it because if the char’s xSpeed += -4, then the box’s xSpeed += -4.

nvm i got it now

1 Like