spaceship/GasCounter.gd
2026-08-13 23:28:57 +02:00

35 lines
1.2 KiB
GDScript

extends NeonNumber
# Banked gas companion to the ore counter. Keeping it as the same neon
# numeral language makes both resources equally legible without implying gas
# can pay for ore-only construction.
const GAS_GLOW: Color = Color(0.85, 0.52, 1.0)
const GAS_CORE: Color = Color(0.2, 0.04, 0.28)
func _ready() -> void:
glow_color = GAS_GLOW
core_color = GAS_CORE
func _process(_delta: float) -> void:
set_amount(GameState.gas)
func _draw() -> void:
# Gas keeps the segmented count used by ore, but replaces ore's mining
# hex with the three-bubble resource glyph. The label above it now names
# the same icon rather than describing a pink recolour of ore.
var h: float = digit_height
var s: float = h / 60.0
for bubble in [[Vector2(21, 36), 13.0], [Vector2(35, 42), 17.0], [Vector2(39, 23), 9.0]]:
var ring := PackedVector2Array()
for i in range(12):
var angle := TAU * float(i) / 12.0
ring.append((bubble[0] + Vector2(cos(angle), sin(angle)) * bubble[1]) * s)
NeonDraw.draw_glowing_polygon(self, ring, GAS_GLOW, 1.0, GAS_CORE, 0.55 * s)
var x: float = h * 1.10
var w: float = h * 0.56
for digit in str(maxi(amount, 0)):
_draw_digit(int(digit), Vector2(x, 0.0), w, h)
x += w + digit_gap