47 lines
1.6 KiB
GDScript3
47 lines
1.6 KiB
GDScript3
|
|
extends Node2D
|
||
|
|
|
||
|
|
# Preview scene - NOT run by run_tests.sh (underscore prefix). Renders
|
||
|
|
# projectiles and every explosion type so the node-animation conversion
|
||
|
|
# (issue #10) can be checked by eye. Bolts once went INVISIBLE after a
|
||
|
|
# similar optimisation and headless tests did not catch it, because
|
||
|
|
# --headless has no GPU - so this exists to make that failure visible.
|
||
|
|
#
|
||
|
|
# bash tests/screenshot.sh res://tests/_vfx_preview.tscn out.png 20
|
||
|
|
|
||
|
|
const VFX_SCRIPTS: Array = [
|
||
|
|
"res://ShipExplosionVFX.gd", "res://EnemyExplosionVFX.gd",
|
||
|
|
"res://AsteroidExplosionVFX.gd", "res://LightBurstVFX.gd",
|
||
|
|
]
|
||
|
|
|
||
|
|
|
||
|
|
func _ready() -> void:
|
||
|
|
RenderingServer.set_default_clear_color(Color(0.02, 0.03, 0.06))
|
||
|
|
|
||
|
|
# Bolts at several headings, held still so they can be inspected.
|
||
|
|
var bolt_scene: PackedScene = load("res://Projectile.tscn")
|
||
|
|
for i in range(6):
|
||
|
|
var bolt: Area2D = bolt_scene.instantiate()
|
||
|
|
bolt.position = Vector2(-460.0 + float(i) * 90.0, -220.0)
|
||
|
|
bolt.rotation = float(i) * 0.35
|
||
|
|
add_child(bolt)
|
||
|
|
bolt.set_physics_process(false)
|
||
|
|
|
||
|
|
# One of each explosion, stepped forward by hand then frozen. Their real
|
||
|
|
# lifetime is under a second, and a softpipe frame takes far longer than
|
||
|
|
# that in wall-clock, so they would expire before the capture.
|
||
|
|
for i in range(VFX_SCRIPTS.size()):
|
||
|
|
var script: Script = load(VFX_SCRIPTS[i])
|
||
|
|
if script == null:
|
||
|
|
continue
|
||
|
|
var vfx: Node2D = Node2D.new()
|
||
|
|
vfx.set_script(script)
|
||
|
|
vfx.position = Vector2(-390.0 + float(i) * 260.0, 90.0)
|
||
|
|
vfx.lifetime = 999.0
|
||
|
|
add_child(vfx)
|
||
|
|
for step in range(8):
|
||
|
|
vfx._process(0.05)
|
||
|
|
vfx.set_process(false)
|
||
|
|
|
||
|
|
var cam: Camera2D = Camera2D.new()
|
||
|
|
add_child(cam)
|
||
|
|
cam.make_current()
|