deflect the ball in same incoming direction
ballVelocity.y = -ballVelocity.y
this above statement makes the ball deflect ,similar to pong game but开发者_运维问答 ..
I am stuck in making the ball deflect the same direction as the incoming direction ..
Negate the x velocity as well, as in ballVelocity.x = -ballVelocity.x
.
精彩评论