DashBoomColorClash/scenes/GameUI.gd

23 lines
639 B
GDScript

extends Control
@export var world_path : NodePath = NodePath()
@onready var player1_score_label : Label = $'Player1Widgets/ScoreLabel'
@onready var player2_score_label : Label = $'Player2Widgets/ScoreLabel'
@onready var player2_widgets : Control = $'Player2Widgets'
var world : World = null
# Called when the node enters the scene tree for the first time.
func _ready():
world = get_node(world_path)
if world.players.size() == 1:
player2_widgets.visible = false
func _process(_delta):
player1_score_label.text = str(world.players[0].score)
if player2_widgets.visible:
player2_score_label.text = str(world.players[1].score)