1
Fork 0
mirror of https://github.com/Steffo99/hella-farm.git synced 2024-11-24 17:14:23 +00:00
This commit is contained in:
Steffo 2024-04-30 03:06:20 +02:00
parent af1cb67796
commit a508ef5490
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
4 changed files with 57 additions and 18 deletions

View file

@ -1,11 +1,17 @@
[gd_scene load_steps=13 format=3 uid="uid://b3gydtrenbw3n"]
[gd_scene load_steps=20 format=3 uid="uid://b3gydtrenbw3n"]
[ext_resource type="Script" path="res://entities/skull.gd" id="1_7g8bu"]
[ext_resource type="Texture2D" uid="uid://dwvvwjdexdywh" path="res://entities/skull.png" id="1_v6qk3"]
[ext_resource type="PackedScene" uid="uid://dijcjahkddudv" path="res://behaviours/draggable.tscn" id="2_h0icd"]
[ext_resource type="PackedScene" uid="uid://rx24bppccih7" path="res://behaviours/move_physics.tscn" id="3_83m1a"]
[ext_resource type="PackedScene" uid="uid://ccul07w0h36nu" path="res://behaviours/sacrificable.tscn" id="3_r8hir"]
[ext_resource type="PackedScene" uid="uid://djcwis8ycrq85" path="res://behaviours/sampler_priority.tscn" id="4_xvv7l"]
[ext_resource type="AudioStream" uid="uid://dq3xf4i2wpt50" path="res://entities/skull_drag.wav" id="5_duqrf"]
[ext_resource type="PackedScene" uid="uid://cml7rqvyfuagx" path="res://behaviours/move_towards.tscn" id="5_lnjls"]
[ext_resource type="AudioStream" uid="uid://cwsg776c11xfc" path="res://entities/fall.ogg" id="6_7yx26"]
[ext_resource type="PackedScene" uid="uid://cm67ko1k6kn4u" path="res://behaviours/priority.tscn" id="6_8jeho"]
[ext_resource type="PackedScene" uid="uid://ctpn4hvkhxoi3" path="res://behaviours/tracker_edible.tscn" id="7_nx0gx"]
[ext_resource type="PackedScene" uid="uid://dti7l0d40hhgt" path="res://behaviours/target_picker.tscn" id="8_0o770"]
[sub_resource type="CircleShape2D" id="CircleShape2D_ypibs"]
radius = 12.0
@ -101,8 +107,11 @@ _data = {
"drag_start": SubResource("Animation_2igbw")
}
[sub_resource type="CircleShape2D" id="CircleShape2D_1c7gd"]
radius = 12.0
[sub_resource type="CircleShape2D" id="CircleShape2D_dsv26"]
radius = 32.0
[sub_resource type="CircleShape2D" id="CircleShape2D_d45uh"]
radius = 32.0
[node name="Skull" type="CharacterBody2D"]
y_sort_enabled = true
@ -128,12 +137,39 @@ libraries = {
next/drag_loop = &"drag_loop"
next/drag_start = &"drag_loop"
[node name="Sacrificable" parent="." instance=ExtResource("3_r8hir")]
kind = &"Skull"
[node name="MovementSampler" parent="." instance=ExtResource("4_xvv7l")]
[node name="MovementTrap" parent="." instance=ExtResource("5_lnjls")]
speed = 600.0
enabled = false
[node name="TrapPriority" parent="MovementTrap" instance=ExtResource("6_8jeho")]
alternative_priority = 45
[node name="TrackerTrap" parent="MovementTrap" instance=ExtResource("7_nx0gx")]
collision_mask = 8
acceptable_diets = Array[StringName]([&"Trap"])
[node name="Shape" type="CollisionShape2D" parent="MovementTrap/TrackerTrap"]
shape = SubResource("CircleShape2D_dsv26")
debug_color = Color(1, 0.498039, 0, 0)
[node name="TargetPicker" parent="MovementTrap/TrackerTrap" node_paths=PackedStringArray("tracker") instance=ExtResource("8_0o770")]
tracker = NodePath("..")
[node name="MovementDrag" parent="." instance=ExtResource("3_83m1a")]
enabled = false
[node name="DragPriority" parent="MovementDrag" instance=ExtResource("6_8jeho")]
alternative_priority = 50
[node name="Draggable" parent="MovementDrag" instance=ExtResource("2_h0icd")]
[node name="Shape" type="CollisionShape2D" parent="MovementDrag/Draggable"]
shape = SubResource("CircleShape2D_1c7gd")
shape = SubResource("CircleShape2D_d45uh")
debug_color = Color(1, 1, 1, 0)
[node name="DragSound" type="AudioStreamPlayer2D" parent="MovementDrag"]
@ -144,9 +180,21 @@ bus = &"DragSounds"
stream = ExtResource("6_7yx26")
bus = &"FallSounds"
[connection signal="changed_target" from="MovementTrap" to="MovementTrap/TrapPriority" method="priority_conditional"]
[connection signal="move" from="MovementTrap" to="." method="_on_move"]
[connection signal="move_disabled" from="MovementTrap" to="." method="_on_freed"]
[connection signal="move_enabled" from="MovementTrap" to="." method="_on_trapped"]
[connection signal="area_entered" from="MovementTrap/TrackerTrap" to="MovementTrap/TrackerTrap" method="check_diet_then_track"]
[connection signal="area_exited" from="MovementTrap/TrackerTrap" to="MovementTrap/TrackerTrap" method="untrack"]
[connection signal="tracked" from="MovementTrap/TrackerTrap" to="MovementTrap/TrackerTrap/TargetPicker" method="sample_target_if_null" unbinds=1]
[connection signal="untracked" from="MovementTrap/TrackerTrap" to="MovementTrap/TrackerTrap/TargetPicker" method="clear_if_target"]
[connection signal="target_changed" from="MovementTrap/TrackerTrap/TargetPicker" to="MovementTrap" method="set_target" unbinds=1]
[connection signal="target_changed" from="MovementTrap/TrackerTrap/TargetPicker" to="MovementTrap/TrackerTrap/TargetPicker" method="sample_target_if_null" unbinds=2]
[connection signal="dragged" from="MovementDrag" to="." method="_on_dragged"]
[connection signal="dragged" from="MovementDrag" to="MovementDrag/DragPriority" method="priority_alternative" unbinds=1]
[connection signal="dragged" from="MovementDrag" to="MovementDrag/DragSound" method="play" unbinds=1]
[connection signal="fallen" from="MovementDrag" to="." method="_on_fallen"]
[connection signal="fallen" from="MovementDrag" to="MovementDrag/DragPriority" method="priority_default"]
[connection signal="fallen" from="MovementDrag" to="MovementDrag/FallSound" method="play"]
[connection signal="move" from="MovementDrag" to="." method="_on_move"]
[connection signal="dragged" from="MovementDrag/Draggable" to="MovementDrag" method="drag"]

View file

@ -14,17 +14,9 @@ func _on_move(movement: Vector2):
sprite.handle_move(movement)
func _on_dragged(_cursor: Cursor) -> void:
collision_layer = 16
collision_mask = 18
z_index = Enums.ZIndex.EntityAir
y_sort_enabled = false
animator.play(&"drag_start")
func _on_fallen() -> void:
collision_layer = 8
collision_mask = 14
z_index = Enums.ZIndex.EntityGround
y_sort_enabled = true
animator.play(&"RESET")
func _on_trapped() -> void:
@ -32,5 +24,5 @@ func _on_trapped() -> void:
y_sort_enabled = false
func _on_freed() -> void:
z_index = Enums.ZIndex.EntityGround
z_index = Enums.ZIndex.EntityAir
y_sort_enabled = true

View file

@ -156,14 +156,13 @@ radius = 25.19
radius = 32.0
[node name="Watcher" type="CharacterBody2D"]
y_sort_enabled = true
collision_layer = 8
collision_mask = 14
collision_layer = 16
collision_mask = 18
script = ExtResource("1_brahc")
[node name="Sprite" parent="." instance=ExtResource("1_thu73")]
unique_name_in_owner = true
y_sort_enabled = true
z_index = 10
scale = Vector2(2, 2)
texture = ExtResource("2_32yw7")
left_texture = ExtResource("2_32yw7")

View file

@ -15,7 +15,7 @@ radius = 8.0
[node name="Cursor" type="Area2D" groups=["cursor"]]
z_index = 100
collision_layer = 64
collision_mask = 40
collision_mask = 56
script = ExtResource("1_1og6v")
[node name="Shape" type="CollisionShape2D" parent="."]