spaceship/planets/BossPlanetVisual.gd

51 lines
1.8 KiB
GDScript3
Raw Normal View History

2026-09-03 10:33:05 +02:00
extends Node2D
# The space-side landmark: organic, asymmetric and visibly awake. The landed
# encounter uses the same pink/cyan palette at a much larger scale.
const RADIUS: float = 104.0
const FLESH_COLOR := Color(0.95, 0.18, 0.58)
const VEIN_COLOR := Color(0.25, 0.9, 1.0)
const CORE_COLOR := Color(0.11, 0.015, 0.08)
var phase: float = 0.0
func configure(shape_seed: int) -> void:
phase = float(posmod(shape_seed, 628)) / 100.0
queue_redraw()
func extractor_anchor() -> Vector2:
return Vector2(0.0, -(RADIUS + 36.0))
func _process(delta: float) -> void:
phase += delta
queue_redraw()
func _draw() -> void:
# Eight short feelers make this read as a creature before the central eye
# is even noticed.
for i in range(8):
var angle: float = TAU * float(i) / 8.0 + phase * 0.08
var points := PackedVector2Array()
for step in range(7):
var t: float = float(step) / 6.0
var radial: float = lerpf(RADIUS * 0.72, RADIUS * 1.35, t)
var curl: float = sin(t * PI * 1.7 + phase * 1.5 + float(i)) * 0.16 * t
points.append(Vector2.from_angle(angle + curl) * radial)
NeonDraw.draw_glowing_path(self, points, FLESH_COLOR, 0.75, 0.55, CORE_COLOR)
var body := PackedVector2Array()
for i in range(24):
var angle: float = TAU * float(i) / 24.0
var pulse: float = 1.0 + 0.035 * sin(phase * 2.2 + float(i) * 1.7)
body.append(Vector2.from_angle(angle) * RADIUS * pulse)
NeonDraw.draw_glowing_polygon(self, body, FLESH_COLOR, 0.9, CORE_COLOR)
var eye_scale: float = 1.0 + 0.08 * sin(phase * 3.0)
draw_set_transform(Vector2.ZERO, 0.0, Vector2(0.62, 1.0) * eye_scale)
NeonDraw.draw_glowing_circle(self, Vector2.ZERO, 34.0, VEIN_COLOR, 1.0, CORE_COLOR)
NeonDraw.draw_glowing_circle(self, Vector2.ZERO, 13.0, Color.WHITE, 1.0, CORE_COLOR)
draw_set_transform(Vector2.ZERO, 0.0, Vector2.ONE)