Add gas giant resource system

This commit is contained in:
Loïc Wisniewski 2026-08-13 21:07:35 +02:00
commit fc68c4e8cf
9 changed files with 180 additions and 10 deletions

View file

@ -41,6 +41,7 @@ const RULE_COLOR: Color = Color(0.25, 0.55, 0.7)
var _numbers: Array[NeonNumber] = []
var _captions: Array[Label] = []
var _gas_caption: Label
func _ready() -> void:
@ -69,6 +70,11 @@ func _ready() -> void:
_layout()
resized.connect(_layout)
_gas_caption = Label.new()
_gas_caption.mouse_filter = Control.MOUSE_FILTER_IGNORE
_gas_caption.add_theme_font_size_override("font_size", 20)
_gas_caption.add_theme_color_override("font_color", Color(0.85, 0.52, 1.0))
add_child(_gas_caption)
func _layout() -> void:
@ -80,9 +86,14 @@ func _layout() -> void:
# The hexagon and digits are drawn from the node's own origin, so the
# number is positioned rather than sized.
_numbers[i].position = Vector2(x, CAPTION_HEIGHT + CAPTION_GAP)
if _gas_caption != null:
_gas_caption.position = Vector2(size.x - 110.0, 2.0)
_gas_caption.size = Vector2(106.0, CAPTION_HEIGHT)
_gas_caption.horizontal_alignment = HORIZONTAL_ALIGNMENT_RIGHT
func _process(_delta: float) -> void:
_gas_caption.text = "GAS %d" % GameState.gas
_numbers[0].set_amount(GameState.rocks)
_numbers[1].set_amount(GameState.fleet_cargo)