Smooth boosted fleet travel

This commit is contained in:
Loïc Wisniewski 2026-09-04 20:01:56 +02:00
commit fd792e8b63
12 changed files with 90 additions and 8 deletions

View file

@ -103,6 +103,13 @@ var keyboard_steering: bool = false
func _ready() -> void:
# Most visuals still animate per rendered frame. The main/surface scenes opt
# their roots out of global interpolation, then opt their physics-follow
# camera and Ship.tscn hulls back in.
# Running the camera after ordinary physics nodes lets it follow the ships'
# newest centroid, and interpolation fills the display frames in between.
process_physics_priority = 1
camera.reset_physics_interpolation()
# #148: the main theme, which outlives this scene - see Music.ensure().
# This script is the root of BOTH the space scene and the planet
# surface, so one call here covers the whole game.
@ -292,7 +299,7 @@ func _process(delta: float) -> void:
_update_pivot(delta)
# Keep the heading fresh while a control is held. Fleet advances its own
# anchor in _process, so this only needs to report the direction. The
# anchor in _physics_process, so this only needs to report the direction. The
# keyboard takes precedence, and releasing the keys has to stop the fleet
# itself - unlike the stick, there is no centred-again signal to hook.
# #124: the breach drives. One check here covers the stick, the keyboard
@ -303,6 +310,12 @@ func _process(delta: float) -> void:
else:
_apply_steering()
func _physics_process(delta: float) -> void:
_update_camera(delta)
func _update_camera(delta: float) -> void:
var target: Vector2 = fleet.get_centroid()
if camera.global_position.distance_to(target) <= camera_snap_distance:
# Snap and stop dead - see camera_snap_distance. Assigning the exact