added stamina and health bar, gold can now be picked up

This commit is contained in:
2025-06-25 21:07:48 -05:00
parent 3e506590a9
commit 60432795f2
9 changed files with 99 additions and 46 deletions

View File

@@ -1,2 +1,24 @@
extends RigidBody3D
class_name Gold
var amount = 1
var follow_target
var spawn_out = false
const SPAWN_OUT_SIZE = 4.0
const SPAWN_OUT_HEIGHT = 14.0
func _process(delta: float) -> void:
if follow_target != null:
if spawn_out:
#if global_position.y < SPAWN_OUT_HEIGHT: REMOVED BECAUSE I DIDN'T LIKE THE LOOK, LEAVING FOR NOW IN CASE I WANT TO MAKE A DIFFERENT EFFECT HAPPEN
#linear_velocity = Vector3(0,10,0)
#else:
follow_target.gold += amount
queue_free()
else:
if global_position.distance_to(follow_target.global_position) < .5:
spawn_out = true
else:
var direction_to_player = global_position.direction_to(follow_target.global_position)
var distance_to_player = global_position.distance_to(follow_target.global_position)
linear_velocity = direction_to_player * (5 + distance_to_player * 3)