Compare commits

..

No commits in common. "5b8d7fdccee510eb617c708ef06651b83ffd16a4" and "9b229e5d8ff44797aa12c4dd9090fe7b149e3f95" have entirely different histories.

2 changed files with 16 additions and 18 deletions

View file

@ -16,23 +16,21 @@ var direction = Vector3.ZERO
var target_velocity = Vector3.ZERO
func resize_ui():
var hud_h = 200
var bpui_h = 200
var size = get_viewport().get_visible_rect().size
$Message.size.x = size.x
$HUD.size.x = size.x
$HUD.size.y = hud_h
$HUD.position.x = 0
$HUD.position.y = size.y - hud_h
$BackpackUI.size.x = size.x
$BackpackUI.size.y = bpui_h
$BackpackUI.position.x = 0
$BackpackUI.position.y = size.y - bpui_h
func make_hud():
var text = ""
func make_backpack_ui():
var text = "Holding " + $Pivot/Container/Gear.gear_name()
for node in $Backpack.get_children():
if not node is Gear:
continue
text += "%s (%s)\n" % [node.gear_name(), node.name]
text += "Holding " + $Pivot/Container/Gear.gear_name() + "\n"
text += str(health) + " hp"
$HUD.text = text
text += "\n%s (%s)" % [node.gear_name(), node.name]
$BackpackUI.text = text
func message(string):
$Message.text = string
@ -42,7 +40,7 @@ func message(string):
func die():
suspended = true
visible = false
$HUD.visible = false
$BackpackUI.visible = false
# strip gears
for gear in $Backpack.get_children():
@ -63,8 +61,8 @@ func respawn():
var gear = starting_gear.instantiate()
$Pivot/Container.add_child(gear)
make_hud()
$HUD.visible = true
make_backpack_ui()
$BackpackUI.visible = true
# Backpack functions
@ -89,7 +87,7 @@ func use_backpack_slot(n):
old.reparent($Backpack, false)
get_node(gear_node).reparent($Pivot/Container, false)
get_node("Pivot/Container/" + n).name = "Gear"
make_hud()
make_backpack_ui()
return
# couldn't find a free slot, so replace
# the new slot with the current gear
@ -97,7 +95,7 @@ func use_backpack_slot(n):
old.reparent($Backpack, false)
old.name = n
get_node("Pivot/Container/" + n).name = "Gear"
make_hud()
make_backpack_ui()
return
func equip(gear: Gear):
@ -122,7 +120,7 @@ func equip(gear: Gear):
new_gear = gear.duplicate()
new_gear.name = "Gear"
$Pivot/Container.add_child(new_gear)
make_hud()
make_backpack_ui()
message("You picked up a " + gear_name + "!")
return true
# if no slots are free

View file

@ -93,7 +93,7 @@ vertical_alignment = 1
wait_time = 4.0
one_shot = true
[node name="HUD" type="Label" parent="."]
[node name="BackpackUI" type="Label" parent="."]
offset_right = 200.0
offset_bottom = 200.0
text = "Pictures of you"