Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to make sprites bounce
- triton999
-
Scratcher
5 posts
How to make sprites bounce
I am making a project that requires sprites to bounce off each other but I can't figure out how. It uses velocity vectors. Link to the project Bouncing Sprunkis
- player_88
-
Scratcher
10 posts
How to make sprites bounce
when your working with velocities, you can multiply them both by -1 to make the sprite bounce.
hope that helped.
set [x velocity v] to ((x velocity) * (-1))usually you would check for bouncing right after moving the sprite on that axis.
set [y velocity v] to ((y velocity) * (-1))
foreverif you want to make it bounce less, then you can multiply by something between 0 and -1, like -0.5
change x by (x velocity)
if <collision?> then
set [x velocity v] to ((x velocity) * (-1))
end
change y by (y velocity)
if <collision?> then
set [y velocity v] to ((y velocity) * (-1))
end
end
hope that helped.
- Discussion Forums
- » Help with Scripts
-
» How to make sprites bounce

