we all know that a square has 4 sides I will call them 1 2 3 and 4
I have a ball that will collide with this square what I want to happen is this:
if ball collides with side 1 3 destroy ball
any ideas? please help.
if the ball if significantly smaller than the square, compare their positions when they collide : you'll see of which side the ball is nearest.
you can also do this if the ball is bigger, but you'll have to take in account the speed of the ball : you determine the position of the "front" of the ball then you compare it to the position of the square.
sounds good thank you!!
Develop games in your browser. Powerful, performant & highly capable.
On ball collision with square
(sub event) compare 2 values ball.x > square.x -> destroy ball 3
(sub event) compare 2 values ball.x < square.x -> destroy ball 1