Finished basic needs
This commit is contained in:
@@ -15,6 +15,8 @@ func _ready() -> void:
|
||||
child.set_item(null)
|
||||
child.inventory = self
|
||||
|
||||
GlobalSignals.on_give_player_item.connect(on_give_player_item)
|
||||
|
||||
for item in starter_items:
|
||||
add_item(item)
|
||||
|
||||
|
||||
@@ -55,4 +55,16 @@ func _on_pressed():
|
||||
remove_item()
|
||||
|
||||
func drop_item():
|
||||
pass
|
||||
if item == null:
|
||||
return
|
||||
|
||||
var world_item = item.world_item_scene.instantiate()
|
||||
add_child(world_item)
|
||||
world_item.position = inventory.get_parent().position + Vector3(0, 1.5, 0) - inventory.get_parent().basis.z
|
||||
remove_item()
|
||||
|
||||
|
||||
func _on_gui_input(event: InputEvent) -> void:
|
||||
if event is InputEventMouseButton and event.pressed:
|
||||
if event.button_index == MOUSE_BUTTON_RIGHT:
|
||||
drop_item()
|
||||
|
||||
@@ -46,6 +46,7 @@ label_settings = SubResource("LabelSettings_0eju6")
|
||||
horizontal_alignment = 2
|
||||
vertical_alignment = 2
|
||||
|
||||
[connection signal="gui_input" from="." to="." method="_on_gui_input"]
|
||||
[connection signal="mouse_entered" from="." to="." method="_on_mouse_entered"]
|
||||
[connection signal="mouse_exited" from="." to="." method="_on_mouse_exited"]
|
||||
[connection signal="pressed" from="." to="." method="_on_pressed"]
|
||||
|
||||
Reference in New Issue
Block a user