27 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			GDScript3
		
	
	
	
	
	
		
		
			
		
	
	
			27 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			GDScript3
		
	
	
	
	
	
|  | extends Control | ||
|  | 
 | ||
|  | @onready var timer: Label = $VBoxContainer/HBoxContainer/MarginContainer2/timer | ||
|  | @onready var coins: Label = $VBoxContainer/HBoxContainer/MarginContainer3/coins | ||
|  | @onready var health: Label = $VBoxContainer/HBoxContainer/MarginContainer/VBoxContainer/health | ||
|  | @onready var health_progress: ProgressBar = $VBoxContainer/HBoxContainer/MarginContainer/VBoxContainer/healthProgress | ||
|  | 
 | ||
|  | 
 | ||
|  | 
 | ||
|  | # Called when the node enters the scene tree for the first time. | ||
|  | func _ready() -> void: | ||
|  | 	health.text="HEALTH" | ||
|  | 	timer.text="TIMER" | ||
|  | 	coins.text="COINS" | ||
|  | 
 | ||
|  | func healthUpdate(currentHealth, maxHealth): | ||
|  | 	print( float(currentHealth) / maxHealth* 100) | ||
|  | 	health.text = "Health: "+str(currentHealth)+" of "+str(maxHealth) | ||
|  | 	health_progress.value = (float(currentHealth) / maxHealth* 100) | ||
|  | 	 | ||
|  | func timerUpdate(timeRemaining, _timeAvailable): | ||
|  | 	#print(timeRemaining, _timeAvailable) | ||
|  | 	timer.text= "Time: "+str(timeRemaining) | ||
|  | func coinsUpdate(coinsCollected, CoinsAvailable): | ||
|  | 	print(coinsCollected, CoinsAvailable) | ||
|  | 	coins.text ="coins: "+str(coinsCollected)+" of "+str(CoinsAvailable) |