Skip to content

Commit

Permalink
Make controls more responsive post-jump
Browse files Browse the repository at this point in the history
  • Loading branch information
jspahrsummers committed Jul 7, 2024
1 parent 28b6e56 commit 1feb41c
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions actors/player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,12 @@ func _unhandled_input(event: InputEvent) -> void:
if event.is_action_pressed("cycle_target"):
self.ship.targeting_system.target = _next_target()
self.get_viewport().set_input_as_handled()

if UserPreferences.control_scheme == UserPreferences.ControlScheme.RELATIVE:
if event.is_action_pressed("thrust"):
self.ship.rigid_body_thruster.throttle = 1.0
elif event.is_action_released("thrust"):
self.ship.rigid_body_thruster.throttle = 0.0

if event.is_action_pressed("fire"):
if event.is_action_pressed("fire", true):
for weapon_mount in self.ship.weapon_mounts:
weapon_mount.fire()

if event.is_action_pressed("jump"):
if event.is_action_pressed("jump", true):
self._jump_to_hyperspace()

func _jump_to_hyperspace() -> void:
Expand All @@ -147,6 +141,11 @@ func _physics_process(_delta: float) -> void:

match UserPreferences.control_scheme:
UserPreferences.ControlScheme.RELATIVE:
if Input.is_action_pressed("thrust"):
self.ship.rigid_body_thruster.throttle = 1.0
else:
self.ship.rigid_body_thruster.throttle = 0.0

if Input.is_action_pressed("turn_backwards"):
self.ship.rigid_body_direction.direction = -self.ship.linear_velocity.normalized()
return
Expand Down

0 comments on commit 1feb41c

Please sign in to comment.