1234567891011121314151617181920 |
- 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:
- current_force = dir * THRUST_STRENGTH
|