Implementing HUD & Changing HUD Style

This commit is contained in:
Jasmine
2021-11-23 23:24:48 -06:00
parent d6af0df27c
commit 74bb8d4b0a
40 changed files with 1086 additions and 211 deletions

View File

@@ -1,6 +1,9 @@
extends KinematicBody2D
const ACCELERATION = 1000
var hud: CanvasLayer = null
const HEALTH_SLICES: Array = [0, 20, 35, 50, 65, 80, 100]
var health_index: int = 6
const MAX_SPEED = 120
const FRICTION = 1000
@@ -22,3 +25,11 @@ func _physics_process(delta) -> void:
velocity = move_and_slide(velocity)
return
func load_hud(node: CanvasLayer) -> void:
hud = node
#if hud.connect('add_currency', self, 'add_currency') != OK:
#print('ERROR: HUD "add_currency" signal already connected.')
hud.update_health(HEALTH_SLICES[health_index])
hud.update_currency($Inventory.get_currency())
return