diff --git a/island/Seeds.gd b/island/Seeds.gd new file mode 100644 index 0000000..ef0a34f --- /dev/null +++ b/island/Seeds.gd @@ -0,0 +1,9 @@ +extends RigidBody3D + + +@export var value = 5 + + +func _on_collectible_by_player_collected(): + var ps: PeaShooter = Singletons.player.get_node("Head/OnHand/PeaShooter") + ps.remaining += value diff --git a/island/Seeds.tscn b/island/Seeds.tscn index bc47946..ec7eac3 100644 --- a/island/Seeds.tscn +++ b/island/Seeds.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=6 format=3 uid="uid://cm0apcnq0f26s"] +[gd_scene load_steps=7 format=3 uid="uid://cm0apcnq0f26s"] [ext_resource type="Texture2D" uid="uid://cdpn34mdaq545" path="res://assets/island_model/texture_1.png" id="1_e06sb"] +[ext_resource type="Script" path="res://island/Seeds.gd" id="1_ndq82"] [ext_resource type="PackedScene" uid="uid://ci0hy0d4d1476" path="res://island/CollectibleByPlayer.tscn" id="5_xl41o"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_meps2"] @@ -35,6 +36,7 @@ mass = 0.01 gravity_scale = 0.0 lock_rotation = true linear_damp = 1.0 +script = ExtResource("1_ndq82") [node name="Seeds" type="MeshInstance3D" parent="."] mesh = SubResource("ArrayMesh_7vmhj") @@ -45,7 +47,6 @@ shape = SubResource("SphereShape3D_geieh") [node name="CollectibleByPlayer" parent="." instance=ExtResource("5_xl41o")] target_path = NodePath("..") -[node name="CollectSound" parent="CollectibleByPlayer" index="0"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0) +[connection signal="collected" from="CollectibleByPlayer" to="." method="_on_collectible_by_player_collected"] [editable path="CollectibleByPlayer"]