spaceship/tests/_hud_preview.gd
2026-09-02 13:43:56 +02:00

39 lines
1.6 KiB
GDScript

extends Node2D
# Preview, not a test - the full combat HUD with every ability control
# visible, so the arrangement around the fire stick can be looked at.
#
# bash tests/screenshot.sh res://tests/_hud_preview.tscn /tmp/hud.png 30 720x1280
func _ready() -> void:
GameState.buildings.clear()
GameState.extractors.clear()
GameState.vessel_levels["unlock_laser"] = 1
GameState.vessel_levels["unlock_gas_bomber"] = 1
GameState.vessel_levels["unlock_distorder"] = 1
GameState.unlocked.append("wing")
GameState.deposit_fleet_resource(GameState.RESOURCE_ENERGY, 200)
GameState.deposit_fleet_resource(GameState.RESOURCE_GAS, 200)
var main: Node = load("res://world/Main.tscn").instantiate()
add_child(main)
main.get_node("EnemySpawner").set_process(false)
main.get_node("AsteroidField").set_process(false)
var fleet: Node = main.get_node("Fleet")
fleet.spawn_ships(4, Vector2.ZERO, PackedStringArray([
GameState.VESSEL_INTERCEPTOR, GameState.VESSEL_LASER,
GameState.VESSEL_GAS_BOMBER, GameState.VESSEL_DISTORDER]))
main.get_node("LaserController")._process(0.0)
main.get_node("GasBombController")._process(0.0)
main.get_node("DashController")._process(0.0)
# Push the fire stick, so its knob shows deflected the way it looks in use.
var stick: Control = main.get_node("UI/FireStick")
var press := InputEventScreenTouch.new()
press.index = 4
press.pressed = true
press.position = stick.global_position + stick.size * 0.5
stick.handle_touch(press)
var drag := InputEventScreenDrag.new()
drag.index = 4
drag.position = press.position + Vector2(46.0, -52.0)
stick.handle_drag(drag)