How to Make a Sprite Bounce off Another Sprite When in Contact?

I’m making a football game for the game jam, and I want the football to, like, bounce off the other sprite that’s touching it. Does anyone know how to do this?

Please answer!
Thx

2 Likes

depends whether there’s a block to tell what face of the sprite is being hit

1 Like

make it so that the velocity of the sprite goes left or right when the sprite touches the ball or sumthing lol

1 Like

How i’d go about it is using jwunderl/arcade-sprite-util to set the balls velocity at the angle from the player who touched it. However, your projects has extensions incompatible with sprite utils, so i don’t know. Maybe see if the incompatible extensions are actually used, or try a different approach.

1 Like

This might not be much help, but you can look at the physics of the ball in this wallball game I made for my friends

I think you just multiply to velocity by -1 to switch it from negative to positive and the other way around.

1 Like
1 Like

Show me how you did it

That just takes away half of my code!!

uhhhhhhh its rather long but heres the most important part:


the pick random is just to make the ball faster on contact, so the real magic is just the (ball) vx * -1

1 Like

I’m afraid that i no longer have a solution…

1 Like

you could try to find the definition of the block in the github repository, and copy/paste it into your project

1 Like