extends Node2D class_name ShipEngine # TODO: implement dashes # TODO: make particles and turbo ## Engine ID to use with Game.get_module @export var id: String = "engine" ## Acceleration speed of the engine @export var acceleration_speed: float = 50.0 ## Rotation speed of the engine @export var rotation_speed: float = 5000.0 ## Shortcut to get_parent() @onready var ship: Ship = get_parent() ## Acceleration control variable var acceleration_axis: float = 0.0 ## Rotation control variable var rotation_axis: float = 0.0 func _physics_process(_delta) -> void: # apply movement and rotation ship.hull.apply_central_force(Vector2.from_angle(ship.hull.rotation) * acceleration_speed * acceleration_axis) ship.hull.apply_torque(rotation_speed * rotation_axis)