working on items and inventory

This commit is contained in:
2023-02-08 22:55:54 -05:00
parent 836a0e4a93
commit 03402abb6c
24 changed files with 617 additions and 117 deletions

View File

@@ -15,17 +15,22 @@ extends PU_Item
func _input(event):
if Input.is_action_pressed("interact") and is_reachable and current_player:
print("ITEM TYPE: ", item_type)
# if item_type == 0: # 0 is weapon
# print("Weapon!")
var result = current_player.add_inventory_item(item_info)
if result:
queue_free()
current_player.add_inventory_item(item_info)
print("Adding inventory item!")
cleanup.rpc()
@rpc("call_local", "any_peer")
func cleanup():
queue_free()
func _on_bomb_pu_area_body_entered(body):
if body.is_in_group("player"):
current_player = body
is_reachable = true
current_player.set_context_label("Pickup " + item_info.item_name + "?")
current_player.set_context_label.rpc_id(current_player.get_multiplayer_authority(), "Pickup " + item_info.item_name + "?")
func _on_bomb_pu_area_body_exited(body):

View File

@@ -6,8 +6,14 @@
[sub_resource type="RectangleShape2D" id="RectangleShape2D_1taf2"]
size = Vector2(20, 34)
[node name="bomb" type="Node"]
[node name="Bomb" type="Node2D"]
script = ExtResource("1_0j4vj")
item_name = "Bomb"
item_description = "Throw and run. Simple and effective."
item_type = 0
item_clip_size = 1
item_ammo = 1
item_texture = ExtResource("2_c4hvj")
[node name="BombPUArea" type="Area2D" parent="."]