ball.gd 312 B

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