mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 00:14:00 +00:00
refactor(*): Restructure game into reusable Arena/GameMode architecture with controller-driven ships, adding Free Play and Match modes
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
class_name PlayerShipController
|
||||
extends ShipController
|
||||
|
||||
# Drives a Ship from the local player's input actions (see project.godot
|
||||
# [input] and FLIGHT_MANUAL.md).
|
||||
|
||||
|
||||
func get_action() -> ShipAction:
|
||||
var action := ShipAction.new()
|
||||
|
||||
# Forward/Backward thrust (main engines)
|
||||
if Input.is_action_pressed("move_forward"):
|
||||
action.thrust.z += 1.0
|
||||
if Input.is_action_pressed("move_back"):
|
||||
action.thrust.z -= 1.0
|
||||
|
||||
# Strafe thrusters (left/right)
|
||||
if Input.is_action_pressed("move_left"):
|
||||
action.thrust.x -= 1.0
|
||||
if Input.is_action_pressed("move_right"):
|
||||
action.thrust.x += 1.0
|
||||
|
||||
# Vertical thrusters (up/down)
|
||||
if Input.is_action_pressed("move_up"):
|
||||
action.thrust.y += 1.0
|
||||
if Input.is_action_pressed("move_down"):
|
||||
action.thrust.y -= 1.0
|
||||
|
||||
# Yaw (turn left/right around Y axis)
|
||||
if Input.is_action_pressed("turn_left"):
|
||||
action.rotation.y += 1.0
|
||||
if Input.is_action_pressed("turn_right"):
|
||||
action.rotation.y -= 1.0
|
||||
|
||||
# Pitch (nose up/down around X axis)
|
||||
if Input.is_action_pressed("pitch_up"):
|
||||
action.rotation.x -= 1.0
|
||||
if Input.is_action_pressed("pitch_down"):
|
||||
action.rotation.x += 1.0
|
||||
|
||||
# Roll (bank left/right around Z axis)
|
||||
if Input.is_action_pressed("roll_left"):
|
||||
action.rotation.z += 1.0
|
||||
if Input.is_action_pressed("roll_right"):
|
||||
action.rotation.z -= 1.0
|
||||
|
||||
action.turbo = Input.is_action_pressed("turbo")
|
||||
|
||||
return action
|
||||
Reference in New Issue
Block a user