ball.gd 340 B

12345678910111213141516171819
  1. extends Area2D
  2. const DEFAULT_SPEED = 100.0
  3. var _speed := DEFAULT_SPEED
  4. var direction := Vector2.LEFT
  5. @onready var _initial_pos := position
  6. func _process(delta: float) -> void:
  7. _speed += delta * 2
  8. position += _speed * delta * direction
  9. func reset() -> void:
  10. direction = Vector2.LEFT
  11. position = _initial_pos
  12. _speed = DEFAULT_SPEED