Bouncing Sprites Off Of Each Other

I am having issues with a program I am making for a school project. It is an RPG which features a small character moving around on a few different maps. However, I have already had problems with the sprites on the canvas. When the character touches the "bush" sprite, I want him to bounce slightly in the opposite direction so he cannot pass through a solid bush, but not matter what I try, I can't seem to get it to work. I have tried searching through other answers, but can't find anything related to this specific issue. If you have any suggestions for how to bounce a user-controlled sprite off of a stationary sprite without completely disabling sprite movement, then I would love to know... thank you!

If you character is moving under its own .Speed and .Heading, check the two attributes that together determine how wide a hop the character takes each time AI2 makes the character move:

  • Speed
  • Interval (ms).

To make sure the character does not hop over an obstacle, take the Width of the obstacle and compare it against the hop size (Speed * Interval). The hop size must be smaller than the Width (or Height, if going up/down) to avoid hopping over the obstacle.

Here is a sample collision event for a golf ball hitting an obstacle ...

This seems like the right idea, but the hard part is that the sprite is controlled by arrow buttons; I think the biggest problem is that it doesn't bounce it far enough and the user can still drive the sprite through the object.

Export your .aia file and upload it here.