Discuss Scratch

tiger18lps
Scratcher
6 posts

How to make a sprite bounce off another sprite?

So I am trying to make ball physics for my game, and I found “if on edge bounce” but I am wondering… How can I make a sprite bounce off another sprite? Thank you.
Blobfish_Industries
Scratcher
100+ posts

How to make a sprite bounce off another sprite?

It would be something like this:

forever
move (10) steps
if <touching [other sprite v] ?> then
turn cw (180) degrees
end
end
deck26
Scratcher
1000+ posts

How to make a sprite bounce off another sprite?

Turning 180 degrees is rarely the correct approach to bouncing. A realistic bounce depends on both the direction of approach and the angle/shape of both objects.

https://scratch.mit.edu/projects/99412537 shows the basic idea and is fine for things like balls bouncing off a flat surface.
Blobfish_Industries
Scratcher
100+ posts

How to make a sprite bounce off another sprite?

I assumed that it would be a more simple simulation, but yeah, 180 degrees would only work if it came in to contact at a direct angle.
ebeachhill
Scratcher
100+ posts

How to make a sprite bounce off another sprite?

tiger18lps wrote:

So I am trying to make ball physics for my game, and I found “if on edge bounce” but I am wondering… How can I make a sprite bounce off another sprite? Thank you.
So. Assuming the platform is horizontally level, you'd usually calculate the angle of the ball's motion and reflect it along an axis.
X-axis:
(((90) - (y position)) * (-1))
Y-axis:
((direction) * (-1))
If you want more than one axis, please quote me so I know of your problem.
g6g6g66g6g
Scratcher
100+ posts

How to make a sprite bounce off another sprite?

Use Griffpatch's ball physics tutorial. This only works if the bouncing sprite is circular.
tiger18lps
Scratcher
6 posts

How to make a sprite bounce off another sprite?

Just to make this more clear, this is what I have in my game

The pointer is the launcher for the balls, and the blocks are supposed to be barriers for the balls, so the balls bounce off of them in contact, but instead, it doesn't. The balls are low gravity and don't slow down.

Last edited by tiger18lps (Dec. 19, 2025 15:28:55)

tiger18lps
Scratcher
6 posts

How to make a sprite bounce off another sprite?

deck26 wrote:

Turning 180 degrees is rarely the correct approach to bouncing. A realistic bounce depends on both the direction of approach and the angle/shape of both objects.

https://scratch.mit.edu/projects/99412537 shows the basic idea and is fine for things like balls bouncing off a flat surface.

I forgot to look at this post, but it looks like it will work. I'll try it. Thanks.

Powered by DjangoBB