Making the bounce angle different depending on where it hit an actor
How do I do this? I am making a breakout style game. And all is going well, although when the ball hits the edge of the paddle I want it to bounce in a different direction then to if it bounced off the middle of it and so on. \
Thanks in advance.
Thanks in advance.
Answers
entryAngle. Say its 30 degrees.
I'd set the center of the paddle to return the ball at the negative entry angle. (note this is not -30, its actually 180-entryAngle)
Since you probably want the ball returning at least in the opposite direction, I'd set one far end of the paddle to return to 90 degrees, and the other far end to return at 180 degrees.
Then I would use proportions to calculate the actual return angles I wanted to use based upon where on the paddle the ball hit, and which way it's moving.
I hope that helps a little.
Thanks.
Elfizm
When overlap or collides with actor of type Paddle
-- Change attribute self.Motion.Linear Velocity.X to self.Motion.Linear Velocity.X+2*(self.Position.X-game.Mouse.Position.X)
This is based on the assumption that you move the paddle with the touch or the mouse.
Thanks heaps.