123456789101112131415161718192021 |
- class_name Ship
- extends RigidBody2D
- # Common base script for ships
- const THRUST_STRENGTH = 400_000
- var current_force = Vector2.ZERO
- func _physics_process(delta):
- apply_central_force(current_force)
- func _on_command(dir: Vector2) -> void:
- _thrust(dir)
- func _thrust(dir: Vector2) -> void:
- print(dir)
- current_force = dir * THRUST_STRENGTH
|