41 lines
1.4 KiB
GDScript
41 lines
1.4 KiB
GDScript
extends Node2D
|
|
|
|
# Preview scene for eyeballing building art - NOT run by run_tests.sh
|
|
# (underscore prefix). Lays out the mothership and command centre alongside
|
|
# several phases of the ship crafter's assembly cycle, with the crafter's
|
|
# _process disabled and anim_time pinned, so a single softpipe render shows
|
|
# the whole animation at once (the renderer is far too slow here to time a
|
|
# live frame).
|
|
#
|
|
# bash tests/screenshot.sh res://tests/_crafter_preview.tscn /tmp/out.png 20
|
|
|
|
# Each cell is either a building type (drawn once) or a crafter phase.
|
|
const CELLS: Array = [
|
|
{"type": "mothership"},
|
|
{"type": "command_center"},
|
|
{"type": "mothership"},
|
|
{"phase": 0.10},
|
|
{"phase": 0.35},
|
|
{"phase": 0.60},
|
|
{"phase": 0.88},
|
|
]
|
|
|
|
|
|
func _ready() -> void:
|
|
RenderingServer.set_default_clear_color(Color(0.02, 0.03, 0.06))
|
|
var building_scene: PackedScene = load("res://Building.tscn")
|
|
for i in range(CELLS.size()):
|
|
var cell: Dictionary = CELLS[i]
|
|
var b: Node2D = building_scene.instantiate()
|
|
b.building_type = cell.get("type", GameState.BUILDING_SHIP_CRAFTER)
|
|
b.position = Vector2(-240.0 + float(i % 3) * 240.0, -105.0 + float(i / 3) * 215.0)
|
|
add_child(b)
|
|
if cell.has("phase"):
|
|
b.visual.set_process(false)
|
|
b.visual.anim_time = float(cell.phase) * b.visual.CYCLE
|
|
b.visual.apply_animation()
|
|
|
|
var cam: Camera2D = Camera2D.new()
|
|
cam.zoom = Vector2(1.65, 1.65)
|
|
add_child(cam)
|
|
cam.make_current()
|