Commit 4a2608c5 authored by Julia Santos's avatar Julia Santos

Still working on inventory UI, still a bit glitchy

parent 14edd5eb
...@@ -8,11 +8,11 @@ func _ready(): ...@@ -8,11 +8,11 @@ func _ready():
updateUI() updateUI()
func updateUI(): func updateUI():
if firstIndex >= inventory.get_item_count() and firstIndex != 0:
firstIndex = firstIndex - 5
var i = 0 var i = 0
while i < 5: while i < 5:
if i < inventory.get_item_count(): if firstIndex + i < inventory.get_item_count():
items[i].set_disabled(false) items[i].set_disabled(false)
items[i].set_button_icon(inventory.get_item_icon(firstIndex + i)) items[i].set_button_icon(inventory.get_item_icon(firstIndex + i))
items[i].set_tooltip(inventory.get_item_text(firstIndex+i)) items[i].set_tooltip(inventory.get_item_text(firstIndex+i))
...@@ -28,6 +28,16 @@ func updateUI(): ...@@ -28,6 +28,16 @@ func updateUI():
#set index? #set index?
print("Updated inventory UI") print("Updated inventory UI")
func _on_Inventory_right_pressed():
if (inventory.get_item_count() > firstIndex + 5):
firstIndex = firstIndex + 5
updateUI()
func _on_Inventory_left_pressed():
if firstIndex != 0:
firstIndex = firstIndex - 5
updateUI()
func disableRest(num): func disableRest(num):
var j = 0 var j = 0
...@@ -84,15 +94,3 @@ func _on_5_toggled(button_pressed): ...@@ -84,15 +94,3 @@ func _on_5_toggled(button_pressed):
enableRest() enableRest()
inventory.unselect_all() inventory.unselect_all()
print(inventory.get_selected_items()) print(inventory.get_selected_items())
func _on_Inventory_right_pressed():
if (inventory.get_item_count() > firstIndex + 4):
firstIndex = firstIndex + 5
updateUI()
func _on_Inventory_left_pressed():
if firstIndex != 0:
firstIndex = firstIndex - 5
updateUI()
...@@ -3,5 +3,5 @@ ...@@ -3,5 +3,5 @@
[ext_resource path="res://assets/Fonts/BeVietnamPro-Medium.ttf" type="DynamicFontData" id=1] [ext_resource path="res://assets/Fonts/BeVietnamPro-Medium.ttf" type="DynamicFontData" id=1]
[resource] [resource]
size = 12 size = 15
font_data = ExtResource( 1 ) font_data = ExtResource( 1 )
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment