diff --git a/balls/ball.gd b/balls/ball.gd index 5cfc5bf..42495cd 100644 --- a/balls/ball.gd +++ b/balls/ball.gd @@ -10,7 +10,18 @@ var _velocity: Vector2 var deg: float func _ready(): - _direction = Vector2.UP.rotated(deg_to_rad(randf_range(0.0, 360.0))) + var randvalue = _get_rand_direction() + _direction = Vector2.UP.rotated(deg_to_rad(randvalue)) + +func _get_rand_direction() -> float: + var value = randf_range(0.0, 360.0) + if value < 10 \ + or (value >= 80 and value < 100) \ + or (value >= 170 and value < 190) \ + or (value >= 260 and value < 280) \ + or value >= 350: + return _get_rand_direction() + return value func _physics_process(delta): _velocity.x = speed * _speed_mult * _direction.x * delta