14 lines
503 B
GDScript
14 lines
503 B
GDScript
extends Node2D
|
|
|
|
## Shortcut to get_parent()
|
|
@onready var ship: Ship = get_parent()
|
|
|
|
func _physics_process(_delta) -> void:
|
|
ship.engine.acceleration_axis = Input.get_axis("deccelerate", "accelerate")
|
|
ship.engine.rotation_axis = Input.get_axis("rotateleft", "rotateright")
|
|
for weapon in ship.weapons.list:
|
|
match weapon.action_id:
|
|
"primary":
|
|
weapon.shoot_request = Input.get_action_strength("shootprimary")
|
|
"secondary":
|
|
weapon.shoot_request = Input.get_action_strength("shootsecondary")
|