Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Gebbu5 |
Disclaimer: I am a coding novice.
Hello!
I have recently been learning about inventory systems in GDScript and have been trying to implement it in a personal project. This tutorial has been a huge help in this regard: GitHub - ThriveVolt/inventory-tutorial at 8-display-item-tooltip
The setup works great but I am struggling with implementing an actual item pickup system. The idea is a simple 2d space where the player character can press a button to pick up an item present in the world.
I was wondering if people had some pointers or tips on how to approach this based on that code. Any assistance would be much appreciated!
Also, based on a previous question I saw here I found a fairly easy way to handle removing the actual object after “collecting”. But that’s about as far as I could make it without having everything break
func _physics_process(delta: float) -> void:
if Input.is_action_just_pressed("interact"):
for body in $InteractRange.get_overlapping_bodies():
if body.is_in_group("herbs"):
body.queue_free()
Gebbu5 | 2023-02-24 12:20