Add incomplete hunger system

This commit is contained in:
snider committed 2022-08-14 01:00:14 -07:00
1 parent f868b86f10
commit ff388ee079
6 files changed
+112 -2

No files matched your search

+14
View File
@@ -4,6 +4,7 @@ const EPSILON = 0.0001
const SPEED = 3.0
export var inventory = { "ore" : 0 }
var health: int = 4 setget set_health
# Called when the node enters the scene tree for the first time.
func _ready():
@@ -16,6 +17,19 @@ func _physics_process(delta):
$DungMan.look_at(global_transform.origin - motion, Vector3.UP)
move_and_slide(motion)
func set_health(new_value):
health = min(new_value, 4)
for child in $"%stomachs".get_children():
child.visible = child.get_index() < health
if health <= 0:
var node = Dialogic.start("starve")
node.pause_mode = PAUSE_MODE_PROCESS
add_child(node)
get_tree().paused = true
yield(node, "timeline_end")
get_tree().paused = false
get_tree().quit() # go back to main menu when such a thing exists
func can_afford(item_name, item_amount):
assert(item_amount > 0)
var current_amount : int = 0