Bounce Behavior

Is it possible to do bounce behavior without using the “Bounce” Function/Behavior?
My problem to that is it can only be used when the object has permanent force given. I want it a behavior the same with “Bounce” but can be used in instant so I can modify the speed of the object anytime by using variable MovementSpeed in the speed.

My initial idea is to store the RandomAngle and the Angle of the object itself.
Then, if the object collides to the wall, the RandomAngle will set to the current Angle + 180 so that it will go to the opposite direction.

I try to experiment on where to put the for each instance. I tried every possible way but it’s not working. Hope someone help me out with this.

Some thoughts :

  1. Minimise the number of repeats you have. On screen you have 2 repeat for each Spinner event blocks. Combine them into 1.

  2. Move the spinner away from the wall part that it’s collided with. Otherwise it may not move away from the wall with the next force that is applied, and stay there.

  3. Put all the wall objects into a group and check for collision with, and move away from, that group.

  4. Why are you setting RandomAngle = Angle + 180? What if angle is away from the wall object? Then it’ll force it back into the wall. I would have thought it should be RandomAngle = RandomAngle + 180


Thanks for the suggestions. I’ll test it out later. I’ll update you on what will happen.

Can you give an actual sample of the revise version my events? I can’t get what you mean.

Something like this :

You’ll need to create the object group named “WallGroup” and add all the wall objects to it.

1 Like

It works but the object kinda colliding 2 times before it goes away to the wall and the angle is not accurate.

The object travels to upper right then goes backwards to lower left (red) which it was meant to go to lower right. (blue) I guess 180 isn’t the right number because it literally do the opposite movement which makes it move it’s path before (backwards) no matter what.

Here’s a screen snip of how the bounce extension does it. You could add this to your own events, and change that last action to suit your needs :