as usual , u got start with a broad smile :pleased:
then try to ask .
here is my problem , i’m designing some game that need to deal with collosion ,
when the ball hit the walls it must change the directions of both _x and _y and no problem till now ,
the problam appear after we put an obstruction -square- in our stage ,
if we still order flash to change both directions of the ball if it hit the obstruction ,
a fatal error 'll hapen , so one direction only got to be changed , and this is only works if the ball hit the obstruction in only two parallel sides, if the ball hits the other two parallel sides the error came again , :snooze: :snooze: :snooze:
i know that u r about to sleep
but let forget all these words , :ub: , and just watch the attatched file ,
and the code is here :
all in the movie clip instance “ball” , the square instance “land”
onClipEvent (load) {
speedX = 20;
speedY = 20;
}
onClipEvent (enterFrame) {
this._x += speedX;
this._y += speedY;
if (this.hitTest(_root.land)) {
speedX = -speedX;
speedY = speedY;
}
if (this._x>=550) {
speedX = -speedX;
} else if (this._x<=0) {
speedX = -speedX;
}
if (this._y>=400) {
speedY = -speedY;
} else if (this._y<=0) {
speedY = -speedY;
}
}
u 'll got the point
hope you can help :+)