Discuss Scratch

McSam97
New Scratcher
4 posts

Bouncing Off of Sprites

I'm taking a class that involves making a pong game, and the instructions tell me to have the ball turn 180 degrees when it hits the paddle. This does not look right to me. I want the ball to bounce off the paddle in the same way it bounces off of the edge. Any input will be appreciated.
deck26
Scratcher
1000+ posts

Bouncing Off of Sprites

If the paddle is horizontal the return angle is 180 minus the approach angle. If it is vertical the return angle is the negative of the approach angle.
P444
Scratcher
500+ posts

Bouncing Off of Sprites

A little colorful style of the above post!^

If falling from the sky (I mean top)
pointindirectiondirection-180
If 2 players of going side ways:
pointindirectiondirection*-1
McSam97
New Scratcher
4 posts

Bouncing Off of Sprites

pointindirection180-direction

not

pointindirectiondirection-180
P444
Scratcher
500+ posts

Bouncing Off of Sprites

McSam97 wrote:

pointindirection180-direction
Sorry but that'd not work, you have to use
pointindirectiondirection-180
McSam97
New Scratcher
4 posts

Bouncing Off of Sprites

I tried that and it didn't work. I tried
pointindirection180-direction
and it did.

Powered by DjangoBB