34 lines
1.3 KiB
GDScript3
34 lines
1.3 KiB
GDScript3
|
|
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)
|