diff --git a/ball.gd b/ball.gd index b55b7c9..934b492 100644 --- a/ball.gd +++ b/ball.gd @@ -5,15 +5,15 @@ const SPEED : float = 300.0 func _ready() -> void: initialize() - func _physics_process(delta: float) -> void: - var collision = move_and_collide(velocity * _delta) - if collision: - velocity = velocity.bounce(collision.get_normal()) +func _physics_process(_delta: float) -> void: + var collision = move_and_collide(velocity * _delta) + if collision: + velocity = velocity.bounce(collision.get_normal()) func initialize(): var extra_offset = 0.0 if randf() < 0.5 else PI var angle = extra_offset + randf_range(-PI/3.0, PI/3.0) - velocity = Vector2(cos(angle), sin(angle)).normalized() * SPEED + velocity = Vector2(cos(angle), sin(angle)).normalized() * SPEED position = get_viewport_rect().size / 2.0 func _on_screen_exited() -> void: