Skip to content

Commit

Permalink
p2
Browse files Browse the repository at this point in the history
  • Loading branch information
NancokPS2 committed Feb 11, 2024
1 parent bf72e18 commit 629364e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions scenes/items/consumables/healthpotion/HealthPotion.gd
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ func _init():
item_class = "HealthPotion"
item_type = ITEM_TYPE.CONSUMABLE
boost.hp = 25
amount_max = 6
18 changes: 17 additions & 1 deletion scenes/player/inventory/InventoryPanel.gd
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,20 @@ const DEFAULT_FONT: Font = preload("res://addons/gut/fonts/LobsterTwo-Regular.tt

@export var item: Item:
set(new_item):
if item is Item and item.amount_changed.is_connected(on_item_amount_changed):
item.amount_changed.disconnect(on_item_amount_changed)

item = new_item
if item:

if item is Item:
if not item.amount_changed.is_connected(on_item_amount_changed):
item.amount_changed.connect(on_item_amount_changed)
$TextureRect.texture = item.get_node("Icon").texture
else:

$TextureRect.texture = null

queue_redraw()

@onready var inventory: Inventory = $"../.."
@onready var drag_panel = $"../../DragPanel"
Expand Down Expand Up @@ -43,6 +52,9 @@ func _ready():
mouse_exited.connect(_on_mouse_exited)





func _draw():
if item is Item:
var font_height: int = 14
Expand Down Expand Up @@ -86,3 +98,7 @@ func _on_mouse_entered():

func _on_mouse_exited():
inventory.mouse_above_this_panel = null


func on_item_amount_changed(item: Item, amount: int):
queue_redraw()

0 comments on commit 629364e

Please sign in to comment.