Hi Helena, Its a good question
But I don't think just adding a random amount every few seconds is what you really need, I could be wrong..but doing that, it would make the Balls flight path unpredictable in a steadily incremental but consistently erratic manner..
Which might be good for funny effects but doesn't simulate accuracy..
I'm also pretty certain that the specific function you require isn't part of The Bullet behaviour Maybe you could suggest its Addition in the Forums...t would be a nice feature
There is a manual work around though that might help and would give you highly 'precise' control over the flight path of the Rebounding Bullet...
Firstly,
To your "Ball" object add an Instance Variable called "Number of Rebounds" or similar & make it a "Number" Type Variable Initial Value 0
Then make a new Event that reads
Ball--> on Collision...Add 1 to Instance Variable "Number of Rebounds" or whatever you named it
Then a new Event or sub event that reads...
Ball-->Compare Instance Variable("Number of Rebounds") is Equal to (4 or 5)
Actions--> Reset Instance Variable("Number of Rebounds")
--> set Ball.Angle to (Ball.Angle) + 1 (more or less if you like)
--> Bounce off Object(wall)
That should be a workable solution for Precise control.
Or the only other idea I can think of is to add a tiny angle of deflection to every rebound ......even a single degree would do it
Assuming you are using the Bullet Behaviour,
There is a "Bounce off" action in the list of events after collision
I presume this is there to enable custom actions in addition to the standard Bullet Behavior
The Events you would need would be something like
-->Ball--->On collision with(walls?)
--> Bounce off Object(wall)
--> set Ball.Angle to (Ball.Angle) + 1
This would make the ball slightly adjust its flight path ..
barely noticeable most of the time but would theoretically prevent it from staying in a locked pattern
You would need to make certain that The Bullet Behaviour "Set Angle" Property in the Property Inspector Tab is Set to "Yes"
Otherwise the Bullets Flight path will not match its Sprite Angle
Timed events may add unnecessary erratic additions to the flight path
of the ball...
But the best way is to test all the methods and see what works best for your game
The most accurate way is to use the On collision Condition events
Another Idea would be to add a tiny amount of Gravity to the Ball object in the Property Inspector Tab...This would always exert a slight natural downwards or upwards force on the Ball..
The Bullet Behaviour has built in Gravity Physics
Hope that helps