Have several instance variables in your bullet object :
- TargetAngle - Numeric
- Shifting - Boolean (False by default)
// Sets the random value and tells the bullet it needs to shift in that direction
Event condition Every 1 sec
- action Set TargetAngle value to random(0,360)
- action set boolean Shifting to True
// The bullet is shifting in the target direction
Event condition Bullet Boolean Shifting is true
- Action Set Bullet.Bullet.AngleOfMotion to anglelerp(Bullet.Bullet.AngleOfMotion, Bullet.TargetAngle, dt * 4)
// We check a range where the angle of motion could be to stop the shifting
Sub event
condition System compare two values - Bullet.Bullet.AngleOfMotion + 2 < Bullet.TargetAngle
AND
condition System Compare two values - Bullet.Bullet.AngleOfMotion - 2 > Bullet.TargetAngle
- Action - Set Bullet.Angle of motion to Bullet.TargetAngle
- Action - Set Shifting to False