Bouncing - Sprites

by virnuls
See inside

If you click the flag, the beach ball will move in a random direction. It will then continue to move, bouncing off the edges of the screen and the purple spot. You can adjust the initial speed of the ball using the variable called speed, and the rate at which the ball slows down using the variable called restitution

The result isn't always perfect - can you improve it?

Notes and Credits

A demonstration of how to bounce one sprite off another. Bouncing can be tricky in Scratch - there is a tile to bounce off the edge, but not a bounce tile to bounce off anything else.

In this program, when a collision occurs, the direction of the ball is stored and then it turns to face the spot. The difference between the two angles is used as the angle of incidence, which can be used to calculate the new direction.

Click here to view a more detailed explanation:

Shared: 26 Jun 2013 Modified: 10 Nov 2014
Favorite this project 6
Love this project 8
Total views 1613
View the remix tree  7
More projects by virnuls