Compare commits
No commits in common. "5b8d7fdccee510eb617c708ef06651b83ffd16a4" and "9b229e5d8ff44797aa12c4dd9090fe7b149e3f95" have entirely different histories.
5b8d7fdcce
...
9b229e5d8f
2 changed files with 16 additions and 18 deletions
|
|
@ -16,23 +16,21 @@ var direction = Vector3.ZERO
|
||||||
var target_velocity = Vector3.ZERO
|
var target_velocity = Vector3.ZERO
|
||||||
|
|
||||||
func resize_ui():
|
func resize_ui():
|
||||||
var hud_h = 200
|
var bpui_h = 200
|
||||||
var size = get_viewport().get_visible_rect().size
|
var size = get_viewport().get_visible_rect().size
|
||||||
$Message.size.x = size.x
|
$Message.size.x = size.x
|
||||||
$HUD.size.x = size.x
|
$BackpackUI.size.x = size.x
|
||||||
$HUD.size.y = hud_h
|
$BackpackUI.size.y = bpui_h
|
||||||
$HUD.position.x = 0
|
$BackpackUI.position.x = 0
|
||||||
$HUD.position.y = size.y - hud_h
|
$BackpackUI.position.y = size.y - bpui_h
|
||||||
|
|
||||||
func make_hud():
|
func make_backpack_ui():
|
||||||
var text = ""
|
var text = "Holding " + $Pivot/Container/Gear.gear_name()
|
||||||
for node in $Backpack.get_children():
|
for node in $Backpack.get_children():
|
||||||
if not node is Gear:
|
if not node is Gear:
|
||||||
continue
|
continue
|
||||||
text += "%s (%s)\n" % [node.gear_name(), node.name]
|
text += "\n%s (%s)" % [node.gear_name(), node.name]
|
||||||
text += "Holding " + $Pivot/Container/Gear.gear_name() + "\n"
|
$BackpackUI.text = text
|
||||||
text += str(health) + " hp"
|
|
||||||
$HUD.text = text
|
|
||||||
|
|
||||||
func message(string):
|
func message(string):
|
||||||
$Message.text = string
|
$Message.text = string
|
||||||
|
|
@ -42,7 +40,7 @@ func message(string):
|
||||||
func die():
|
func die():
|
||||||
suspended = true
|
suspended = true
|
||||||
visible = false
|
visible = false
|
||||||
$HUD.visible = false
|
$BackpackUI.visible = false
|
||||||
|
|
||||||
# strip gears
|
# strip gears
|
||||||
for gear in $Backpack.get_children():
|
for gear in $Backpack.get_children():
|
||||||
|
|
@ -63,8 +61,8 @@ func respawn():
|
||||||
var gear = starting_gear.instantiate()
|
var gear = starting_gear.instantiate()
|
||||||
$Pivot/Container.add_child(gear)
|
$Pivot/Container.add_child(gear)
|
||||||
|
|
||||||
make_hud()
|
make_backpack_ui()
|
||||||
$HUD.visible = true
|
$BackpackUI.visible = true
|
||||||
|
|
||||||
# Backpack functions
|
# Backpack functions
|
||||||
|
|
||||||
|
|
@ -89,7 +87,7 @@ func use_backpack_slot(n):
|
||||||
old.reparent($Backpack, false)
|
old.reparent($Backpack, false)
|
||||||
get_node(gear_node).reparent($Pivot/Container, false)
|
get_node(gear_node).reparent($Pivot/Container, false)
|
||||||
get_node("Pivot/Container/" + n).name = "Gear"
|
get_node("Pivot/Container/" + n).name = "Gear"
|
||||||
make_hud()
|
make_backpack_ui()
|
||||||
return
|
return
|
||||||
# couldn't find a free slot, so replace
|
# couldn't find a free slot, so replace
|
||||||
# the new slot with the current gear
|
# the new slot with the current gear
|
||||||
|
|
@ -97,7 +95,7 @@ func use_backpack_slot(n):
|
||||||
old.reparent($Backpack, false)
|
old.reparent($Backpack, false)
|
||||||
old.name = n
|
old.name = n
|
||||||
get_node("Pivot/Container/" + n).name = "Gear"
|
get_node("Pivot/Container/" + n).name = "Gear"
|
||||||
make_hud()
|
make_backpack_ui()
|
||||||
return
|
return
|
||||||
|
|
||||||
func equip(gear: Gear):
|
func equip(gear: Gear):
|
||||||
|
|
@ -122,7 +120,7 @@ func equip(gear: Gear):
|
||||||
new_gear = gear.duplicate()
|
new_gear = gear.duplicate()
|
||||||
new_gear.name = "Gear"
|
new_gear.name = "Gear"
|
||||||
$Pivot/Container.add_child(new_gear)
|
$Pivot/Container.add_child(new_gear)
|
||||||
make_hud()
|
make_backpack_ui()
|
||||||
message("You picked up a " + gear_name + "!")
|
message("You picked up a " + gear_name + "!")
|
||||||
return true
|
return true
|
||||||
# if no slots are free
|
# if no slots are free
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ vertical_alignment = 1
|
||||||
wait_time = 4.0
|
wait_time = 4.0
|
||||||
one_shot = true
|
one_shot = true
|
||||||
|
|
||||||
[node name="HUD" type="Label" parent="."]
|
[node name="BackpackUI" type="Label" parent="."]
|
||||||
offset_right = 200.0
|
offset_right = 200.0
|
||||||
offset_bottom = 200.0
|
offset_bottom = 200.0
|
||||||
text = "Pictures of you"
|
text = "Pictures of you"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue