scoring working, updates to readme
This commit is contained in:
1 parent
9356bd1c7c
commit
b94006c28e
21 files changed
+317
-48
No files matched your search
@@ -11,6 +11,7 @@ var crate = preload("res://scenes/crate.tscn")
|
||||
@onready var boxtrap = $"../crates/boxtrap"
|
||||
@onready var timer = $Timer
|
||||
@onready var player = $"../CharacterBody2D"
|
||||
@onready var ui = $"../CanvasLayer/UI"
|
||||
|
||||
func _ready():
|
||||
GameManager.resetPlayer()
|
||||
@@ -28,6 +29,7 @@ func _on_area_2d_areatrigger(effect, body):
|
||||
func coinCollected():
|
||||
print("scene manager saw coin collected")
|
||||
GameManager.coinsCollected +=1
|
||||
ui.coinsUpdate(GameManager.coinsCollected)
|
||||
|
||||
func resetGame():
|
||||
timer.start(.5)
|
||||
@@ -42,3 +44,4 @@ func _process(delta):
|
||||
|
||||
func _on_badguy_player_damage():
|
||||
player.hurt()
|
||||
ui.healthUpdate(GameManager.player.health)
|
||||
@@ -0,0 +1,10 @@
|
||||
extends Control
|
||||
|
||||
@onready var health = $VBoxContainer/HBoxContainer/MarginContainer2/Health
|
||||
@onready var coins = $VBoxContainer/HBoxContainer/MarginContainer/Coins
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func healthUpdate(amt):
|
||||
health.text = "Health : "+str(amt)
|
||||
func coinsUpdate(amt):
|
||||
coins.text = "Coins : "+str(amt)
|
||||
Reference in new issue
Block a user