spawns all entities

connected chests to color/ui
This commit is contained in:
2024-02-12 08:07:42 -06:00
parent 8aaedae7c3
commit 6f1d578ee1
23 changed files with 554 additions and 7 deletions

25
scripts/hud.gd Normal file
View File

@@ -0,0 +1,25 @@
extends CanvasLayer
class_name HUD
@onready var progress_bar_red: ProgressBar = $PanelContainer/MarginContainer/VBoxContainer/HBoxContainer/PanelContainerRed/ProgressBar
@onready var progress_bar_green: ProgressBar = $PanelContainer/MarginContainer/VBoxContainer/HBoxContainer/PanelContainerGreen/ProgressBar
@onready var progress_bar_blue: ProgressBar = $PanelContainer/MarginContainer/VBoxContainer/HBoxContainer/PanelContainerBlue/ProgressBar
@onready var texture_rect: TextureRect = $PanelContainer/MarginContainer/VBoxContainer/TextureRect
@onready var lives_container: GridContainer = $PanelContainer/MarginContainer/VBoxContainer/LivesContainer
const HEART = preload("res://assets/heart.png")
func _on_player_color_changed(color: Color) -> void:
progress_bar_red.value = color.r
progress_bar_green.value = color.g
progress_bar_blue.value = color.b
texture_rect.modulate = color
func _on_player_lives_changed(lives: int) -> void:
var heart_containers = lives_container.get_children()
if heart_containers.size() < lives:
var life = TextureRect.new()
life.texture = HEART
lives_container.add_child(life)
elif heart_containers.size() > lives:
heart_containers.pop_back().queue_free()