Box Pushing in AS2


#1

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


#2

Why is it doing it?


#3

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.


#4

nvm i got it now