spaceship/tests/_building_health_preview.gd
Loïc Wisniewski 78836882af Sharpen upgrades, mark the convoy's destination, and give the world sound
#204 the Beam Collimator widens the beam instead of adding range to one that
already crosses the screen; beam width becomes a per-shot vessel stat.
#205 the Energy Propulser gains three upgrades - dash recharge, dash reach,
and boosted-cruise drain - which turns three constants into vessel stats.
#206 three further doctrines carry the fleet from ten to twenty.
#207 the prologue's World Ship gets a marker, through the scanner's own
guidance arrow rather than a second one.
#208 #210 #213 #214 four new synthesised sounds: the breach opening, cargo
reaching the hold, a rock breaking, and a gas bomb blooming.
#215 building health bars are larger, plated and framed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019AJMdB7iuHuLFZM1aBu3GD
2026-09-05 12:16:17 +02:00

34 lines
1.3 KiB
GDScript

extends Node2D
# Preview, not a test - #215's health bars, through the real game path. A bar
# is only drawn on a DAMAGED structure, so this hurts each one by a different
# amount: full, most, half, and nearly gone, left to right.
#
# bash tests/screenshot.sh res://tests/_building_health_preview.tscn shots/building_health.png 3 720x1280
func _ready() -> void:
GameState.buildings.clear()
GameState.extractors.clear()
GameState.intro_active = false
GameState.reset_formation()
var placed: Array = [
[GameState.BUILDING_MOTHERSHIP, Vector2(-330.0, 0.0), 0.0],
[GameState.BUILDING_SHIP_CRAFTER, Vector2(140.0, 0.0), 0.25],
[GameState.BUILDING_TRANSPORT_HUB, Vector2(480.0, 0.0), 0.5],
[GameState.BUILDING_SHIP_LAB, Vector2(820.0, 0.0), 0.85],
]
for entry in placed:
var id: int = GameState.add_building(String(entry[0]), Vector2(entry[1]))
var hurt: float = float(entry[2])
if hurt > 0.0:
GameState.damage_building(id,
int(GameState.building_max_hp(String(entry[0])) * hurt))
var main: Node = load("res://world/Main.tscn").instantiate()
add_child(main)
main.get_node("AsteroidField").set_process(false)
main.get_node("EnemySpawner").set_process(false)
main.get_node("Fleet").move_to(Vector2(240.0, 260.0))
var cam: Camera2D = main.get_node("Camera2D")
cam.zoom = Vector2(0.78, 0.78)