#37 ajout d'item outils ainsi que de visualisation de leur zone d'effet (avec la classe ActionArea

This commit is contained in:
2025-08-19 11:29:20 +02:00
parent b0efeff809
commit 1f301815be
18 changed files with 233 additions and 89 deletions

View File

@@ -1,3 +1,4 @@
@tool
extends Interactable
class_name ItemObject
@@ -21,13 +22,15 @@ func _ready():
generate_collision(10)
func interact(player : Player) -> bool:
if player.inventory.lenght() < player.inventory.max_items:
player.inventory.add_item(item)
pickup_animation(player)
var swapped_item = player.inventory.get_item()
player.get_item(item)
if swapped_item:
item = swapped_item
else :
var swaped_item = player.inventory.swap_items(item)
item = swaped_item
pickup_animation(player)
return true
func pickup_animation(player : Player):