Made interaction area 2d work - and farming/growing work again.

This commit is contained in:
2025-05-14 23:12:14 +02:00
parent 366923699c
commit ff85b67087
15 changed files with 186 additions and 215 deletions
+4 -3
View File
@@ -296,7 +296,7 @@
[ext_resource type="PackedScene" uid="uid://b1d2e7ely6hyw" path="res://prefabs/farm/base_field_2d.tscn" id="294_28qer"]
[sub_resource type="CircleShape2D" id="CircleShape2D_ssqtd"]
radius = 167.672
radius = 110.018
[sub_resource type="SpriteFrames" id="SpriteFrames_4yiyq"]
animations = [{
@@ -1195,9 +1195,10 @@ animations = [{
"speed": 25.0
}]
[node name="Player2d" type="Node2D"]
[node name="Player2d" type="Node2D" node_paths=PackedStringArray("_farmingControls")]
y_sort_enabled = true
script = ExtResource("1_yl84k")
_farmingControls = NodePath("FarmingControls")
[node name="CharacterBody2D" type="CharacterBody2D" parent="." node_paths=PackedStringArray("_sprite")]
position = Vector2(0, 374)
@@ -1208,7 +1209,7 @@ _sprite = NodePath("visuals/Animated Sprites")
[node name="CollisionShape2D" type="CollisionShape2D" parent="CharacterBody2D"]
z_index = 1
y_sort_enabled = true
position = Vector2(-24, -116)
position = Vector2(-24, -13)
shape = SubResource("CircleShape2D_ssqtd")
debug_color = Color(0.923708, 0.202722, 0.475262, 0.42)
+14 -8
View File
@@ -4,21 +4,27 @@
[ext_resource type="Script" uid="uid://bdffon388rkty" path="res://scripts/CSharp/Common/Farming/FieldBehaviour2D.cs" id="2_femni"]
[ext_resource type="Texture2D" uid="uid://c2pirgay3jfnn" path="res://art/farm/tilable grounds/böden/trockene farming erde.png" id="3_lsfck"]
[ext_resource type="Texture2D" uid="uid://ctvdxwgmfaj5c" path="res://art/farm/tilable grounds/böden/nasse farming erde.png" id="4_cus02"]
[ext_resource type="PackedScene" uid="uid://bjhj1wa5olwcu" path="res://prefabs/farm/base_plant.tscn" id="5_msuq8"]
[ext_resource type="PackedScene" uid="uid://c3hwbwo423nbm" path="res://prefabs/farm/base_plant_2d.tscn" id="5_femni"]
[node name="BaseField" type="Node2D"]
[node name="InteractionArea2" parent="." instance=ExtResource("1_femni")]
visible = false
z_index = 1
scale = Vector2(2.225, 2.225)
[node name="FieldBehaviour" type="Sprite2D" parent="."]
scale = Vector2(0.4, 1e-05)
texture = ExtResource("3_lsfck")
script = ExtResource("2_femni")
Tilled = ExtResource("3_lsfck")
Watered = ExtResource("4_cus02")
[node name="BasePlant" parent="FieldBehaviour" node_paths=PackedStringArray("_seeds", "_smallPlants", "_bigPlants", "_readyPlants") instance=ExtResource("5_msuq8")]
transform = Transform3D(0.5, 0, 0, 0, -2.18557e-08, 0.5, 0, -0.5, -2.18557e-08, 0, 0, 0)
_seeds = [null, null, null]
_smallPlants = [null, null, null, null]
_bigPlants = [null, null, null, null]
_readyPlants = [null, null, null, null]
[node name="BasePlant" parent="FieldBehaviour" instance=ExtResource("5_femni")]
[node name="BigPlant" parent="FieldBehaviour/BasePlant" index="2"]
position = Vector2(6, -161)
[node name="ReadyPlant" parent="FieldBehaviour/BasePlant" index="3"]
position = Vector2(0, -204)
[editable path="FieldBehaviour/BasePlant"]
+9 -7
View File
@@ -3,22 +3,24 @@
[ext_resource type="Script" uid="uid://ckp413wrub5fm" path="res://scripts/CSharp/Common/CharacterControls/InteractionArea2D.cs" id="1_6svbd"]
[sub_resource type="CircleShape2D" id="CircleShape2D_npluf"]
radius = 100.0
radius = 300.0
[node name="InteractionArea" type="Node2D" node_paths=PackedStringArray("_area", "_label")]
script = ExtResource("1_6svbd")
_area = NodePath("Area3D")
_area = NodePath("Area2D")
_label = NodePath("Label")
[node name="Area3D" type="Area2D" parent="."]
collision_mask = 16
[node name="Area2D" type="Area2D" parent="."]
[node name="CollisionShape3D" type="CollisionShape2D" parent="Area3D"]
[node name="CollisionShape3D" type="CollisionShape2D" parent="Area2D"]
shape = SubResource("CircleShape2D_npluf")
[node name="Label" type="Label" parent="."]
visible = false
offset_right = 50.0
offset_bottom = 30.0
scale = Vector2(2, 2)
text = "[E]"
[connection signal="body_entered" from="Area3D" to="." method="OnPlayerEntered"]
[connection signal="body_exited" from="Area3D" to="." method="OnPlayerExited"]
[connection signal="body_entered" from="Area2D" to="." method="OnPlayerEntered"]
[connection signal="body_exited" from="Area2D" to="." method="OnPlayerExited"]