So you want it to only bounce at 45, 90, and 135 degree angles? Your picture is a tad confusing, as when it hits the +45 section, it moves at a normal reflective bounce's angle, instead of a 45. And so you know, you can use collide.x to determine which part of the paddle you are colliding with, since if you know that the paddle's x is 0, and the ball's x is 0, then if the difference between the two was 45, then it must be the right side of the paddle, and -45 for the left.
One question though, if the ball is moving at lets say a 300 degree angle, and hits the left side of the paddle, does it still bounce back at a 135 degree angle? If so, then I understood you correctly, and you can do something like this.
paddle -> Collision with Ball -> Script Editor
- Code: Select all
int dir = round(((x+width/2)-collide.x)/(width/2));
// above should set dir to 0 if on the far right of the paddle, 1 if in the center, and 2 if on the left
collide.angle=45*(dir+1);