player: rename BackpackUI to HUD
This commit is contained in:
parent
e616fc4cbb
commit
df449af0f3
2 changed files with 14 additions and 14 deletions
|
|
@ -16,21 +16,21 @@ var direction = Vector3.ZERO
|
|||
var target_velocity = Vector3.ZERO
|
||||
|
||||
func resize_ui():
|
||||
var bpui_h = 200
|
||||
var hud_h = 200
|
||||
var size = get_viewport().get_visible_rect().size
|
||||
$Message.size.x = size.x
|
||||
$BackpackUI.size.x = size.x
|
||||
$BackpackUI.size.y = bpui_h
|
||||
$BackpackUI.position.x = 0
|
||||
$BackpackUI.position.y = size.y - bpui_h
|
||||
$HUD.size.x = size.x
|
||||
$HUD.size.y = hud_h
|
||||
$HUD.position.x = 0
|
||||
$HUD.position.y = size.y - hud_h
|
||||
|
||||
func make_backpack_ui():
|
||||
func make_hud():
|
||||
var text = "Holding " + $Pivot/Container/Gear.gear_name()
|
||||
for node in $Backpack.get_children():
|
||||
if not node is Gear:
|
||||
continue
|
||||
text += "\n%s (%s)" % [node.gear_name(), node.name]
|
||||
$BackpackUI.text = text
|
||||
$HUD.text = text
|
||||
|
||||
func message(string):
|
||||
$Message.text = string
|
||||
|
|
@ -40,7 +40,7 @@ func message(string):
|
|||
func die():
|
||||
suspended = true
|
||||
visible = false
|
||||
$BackpackUI.visible = false
|
||||
$HUD.visible = false
|
||||
|
||||
# strip gears
|
||||
for gear in $Backpack.get_children():
|
||||
|
|
@ -61,8 +61,8 @@ func respawn():
|
|||
var gear = starting_gear.instantiate()
|
||||
$Pivot/Container.add_child(gear)
|
||||
|
||||
make_backpack_ui()
|
||||
$BackpackUI.visible = true
|
||||
make_hud()
|
||||
$HUD.visible = true
|
||||
|
||||
# Backpack functions
|
||||
|
||||
|
|
@ -87,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_backpack_ui()
|
||||
make_hud()
|
||||
return
|
||||
# couldn't find a free slot, so replace
|
||||
# the new slot with the current gear
|
||||
|
|
@ -95,7 +95,7 @@ func use_backpack_slot(n):
|
|||
old.reparent($Backpack, false)
|
||||
old.name = n
|
||||
get_node("Pivot/Container/" + n).name = "Gear"
|
||||
make_backpack_ui()
|
||||
make_hud()
|
||||
return
|
||||
|
||||
func equip(gear: Gear):
|
||||
|
|
@ -120,7 +120,7 @@ func equip(gear: Gear):
|
|||
new_gear = gear.duplicate()
|
||||
new_gear.name = "Gear"
|
||||
$Pivot/Container.add_child(new_gear)
|
||||
make_backpack_ui()
|
||||
make_hud()
|
||||
message("You picked up a " + gear_name + "!")
|
||||
return true
|
||||
# if no slots are free
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue