#37 ajout d'item outils ainsi que de visualisation de leur zone d'effet (avec la classe ActionArea
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://cd3re3552pt7m"]
|
||||
[gd_scene load_steps=2 format=3 uid="uid://b0ecjfdnvhjjf"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dedg615xudpoq" path="res://entities/interactables/item_object/script/item_object.gd" id="1_hxea8"]
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user