meowbay created and other things
This commit is contained in:
parent
09625d8285
commit
93cc1a8c59
35 changed files with 318 additions and 41 deletions
40
inv_system/sell_panel.gd
Normal file
40
inv_system/sell_panel.gd
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
extends Inventory
|
||||
|
||||
@export var sell_label : Label
|
||||
@export var sell_button : Button
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
super()
|
||||
calculate_sell_value()
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
super(delta)
|
||||
pass
|
||||
|
||||
func _notification(what: int) -> void:
|
||||
super(what)
|
||||
if what == Node.NOTIFICATION_DRAG_END:
|
||||
calculate_sell_value()
|
||||
pass
|
||||
|
||||
func calculate_sell_value():
|
||||
if slots[0].item:
|
||||
sell_label.text = str(floori(slots[0].item.buy_value / float(2)))
|
||||
sell_button.disabled = false
|
||||
else:
|
||||
sell_label.text = "Place an item"
|
||||
sell_button.disabled = true
|
||||
|
||||
|
||||
func _on_sell_button_pressed() -> void:
|
||||
if slots[0].item:
|
||||
var sell_value : int = floori(slots[0].item.buy_value / float(2))
|
||||
slots[0].item = null
|
||||
slots[0].update_ui()
|
||||
PlayerInventory.money += sell_value
|
||||
calculate_sell_value()
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue