1
Fork 0
mirror of https://github.com/Steffo99/hella-farm.git synced 2024-11-24 17:14:23 +00:00

Tweak physics again a bit

This commit is contained in:
Steffo 2024-04-22 01:05:21 +02:00
parent a12b46e64c
commit 267682d28c
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0
7 changed files with 33 additions and 15 deletions

View file

@ -13,14 +13,13 @@ func _on_move(movement: Vector2):
func _on_eater_eaten(edible: Edible) -> void:
edible.get_parent().queue_free()
func _on_draggable_dragged(_cursor: Cursor) -> void:
func _on_dragged(_cursor: Cursor) -> void:
collision_layer = 16
collision_mask = 18
z_index = 1
eater.collision_mask = 16
func _on_draggable_dropped() -> void:
func _on_fallen() -> void:
collision_layer = 8
collision_mask = 14
z_index = 0

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=21 format=3 uid="uid://4d3ksr3171x4"]
[gd_scene load_steps=23 format=3 uid="uid://4d3ksr3171x4"]
[ext_resource type="Script" path="res://entities/imp.gd" id="1_dixpc"]
[ext_resource type="PackedScene" uid="uid://bxbjfev0lhwws" path="res://behaviours/sprite_left_right.tscn" id="2_eqcdi"]
@ -16,6 +16,8 @@
[ext_resource type="PackedScene" uid="uid://rx24bppccih7" path="res://behaviours/move_physics.tscn" id="14_p3w0g"]
[ext_resource type="PackedScene" uid="uid://jg7qkbswgqjc" path="res://behaviours/eater.tscn" id="14_w2h8x"]
[ext_resource type="PackedScene" uid="uid://dijcjahkddudv" path="res://behaviours/draggable.tscn" id="15_otrbh"]
[ext_resource type="AudioStream" uid="uid://bmfscpnugaejk" path="res://entities/sheep_drag.wav" id="16_0nbhd"]
[ext_resource type="AudioStream" uid="uid://cwsg776c11xfc" path="res://entities/fall.ogg" id="17_lib0h"]
[sub_resource type="CircleShape2D" id="CircleShape2D_ide4n"]
radius = 32.0
@ -101,6 +103,12 @@ alternative_priority = 50
shape = SubResource("CircleShape2D_50iad")
debug_color = Color(1, 1, 1, 0)
[node name="DragSound" type="AudioStreamPlayer2D" parent="MovementDrag"]
stream = ExtResource("16_0nbhd")
[node name="FallSound" type="AudioStreamPlayer2D" parent="MovementDrag"]
stream = ExtResource("17_lib0h")
[node name="Eater" parent="." instance=ExtResource("14_w2h8x")]
acceptable_diets = Array[StringName]([&"Meat"])
@ -121,12 +129,14 @@ debug_color = Color(1, 0, 0, 0)
[connection signal="untracked" from="MovementHunt/TrackerMeat" to="MovementHunt/TrackerMeat/TargetPicker" method="clear_if_target"]
[connection signal="target_changed" from="MovementHunt/TrackerMeat/TargetPicker" to="MovementHunt" method="set_target" unbinds=1]
[connection signal="target_changed" from="MovementHunt/TrackerMeat/TargetPicker" to="MovementHunt/TrackerMeat/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="priority_changed_no_args" from="MovementDrag/DragPriority" to="MovementSampler" method="enable"]
[connection signal="dragged" from="MovementDrag/Draggable" to="." method="_on_draggable_dragged"]
[connection signal="dragged" from="MovementDrag/Draggable" to="MovementDrag" method="drag"]
[connection signal="dropped" from="MovementDrag/Draggable" to="." method="_on_draggable_dropped"]
[connection signal="dropped" from="MovementDrag/Draggable" to="MovementDrag" method="drop"]
[connection signal="eaten" from="Eater" to="." method="_on_eater_eaten"]

View file

@ -10,7 +10,7 @@
radius = 12.0
[sub_resource type="CircleShape2D" id="CircleShape2D_juisb"]
radius = 24.0
radius = 12.0
[node name="Monocle" type="CharacterBody2D"]
collision_layer = 8

View file

@ -13,13 +13,12 @@ func _on_move(movement: Vector2) -> void:
move_and_collide(movement)
sprite.handle_move(movement)
func _on_draggable_dragged(_cursor: Cursor) -> void:
func _on_dragged(_cursor: Cursor) -> void:
collision_layer = 16
collision_mask = 18
z_index = 1
func _on_draggable_dropped() -> void:
func _on_fallen() -> void:
collision_layer = 8
collision_mask = 14
z_index = 0

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=22 format=3 uid="uid://bc2bm8lbol18w"]
[gd_scene load_steps=24 format=3 uid="uid://bc2bm8lbol18w"]
[ext_resource type="Script" path="res://entities/sheep.gd" id="1_4dmll"]
[ext_resource type="Texture2D" uid="uid://iljp5yn3ehfk" path="res://entities/sheep_left.png" id="2_t13f5"]
@ -15,6 +15,8 @@
[ext_resource type="PackedScene" uid="uid://dijcjahkddudv" path="res://behaviours/draggable.tscn" id="14_0b1hs"]
[ext_resource type="PackedScene" uid="uid://rx24bppccih7" path="res://behaviours/move_physics.tscn" id="14_3wojv"]
[ext_resource type="PackedScene" uid="uid://c5pyp5hvthdof" path="res://behaviours/tracker_tracker.tscn" id="14_eqowb"]
[ext_resource type="AudioStream" uid="uid://bmfscpnugaejk" path="res://entities/sheep_drag.wav" id="16_nswfl"]
[ext_resource type="AudioStream" uid="uid://cwsg776c11xfc" path="res://entities/fall.ogg" id="17_8kst2"]
[sub_resource type="CircleShape2D" id="CircleShape2D_c5tcn"]
radius = 8.0
@ -176,6 +178,12 @@ scale = Vector2(3, 3)
shape = SubResource("CircleShape2D_c5tcn")
debug_color = Color(1, 1, 1, 0)
[node name="DragSound" type="AudioStreamPlayer2D" parent="MovementDrag"]
stream = ExtResource("16_nswfl")
[node name="FallSound" type="AudioStreamPlayer2D" parent="MovementDrag"]
stream = ExtResource("17_8kst2")
[connection signal="ready" from="MovementSampler" to="MovementSampler" method="enable"]
[connection signal="move" from="MovementIdle" to="." method="_on_move"]
[connection signal="move_disabled" from="MovementIdle" to="MovementIdle/BoredTimer" method="stop"]
@ -201,12 +209,14 @@ debug_color = Color(1, 1, 1, 0)
[connection signal="tracked" from="MovementRunFromHunter/HunterSense" to="MovementRunFromHunter/HunterSense/TargetPicker" method="set_target_if_null"]
[connection signal="untracked" from="MovementRunFromHunter/HunterSense" to="MovementRunFromHunter/HunterSense/TargetPicker" method="clear_if_target"]
[connection signal="target_changed" from="MovementRunFromHunter/HunterSense/TargetPicker" to="MovementRunFromHunter" method="set_target" unbinds=1]
[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="move_enabled" from="MovementDrag" to="MovementWander" method="clear_direction"]
[connection signal="priority_changed_no_args" from="MovementDrag/DragPriority" to="MovementSampler" method="enable"]
[connection signal="dragged" from="MovementDrag/Draggable" to="." method="_on_draggable_dragged"]
[connection signal="dragged" from="MovementDrag/Draggable" to="MovementDrag" method="drag"]
[connection signal="dropped" from="MovementDrag/Draggable" to="." method="_on_draggable_dropped"]
[connection signal="dropped" from="MovementDrag/Draggable" to="MovementDrag" method="drop"]

View file

@ -11,7 +11,7 @@
radius = 12.0
[sub_resource type="CircleShape2D" id="CircleShape2D_1c7gd"]
radius = 24.0
radius = 12.0
[node name="Skull" type="CharacterBody2D"]
collision_layer = 8

View file

@ -10,7 +10,7 @@
radius = 12.0
[sub_resource type="CircleShape2D" id="CircleShape2D_juisb"]
radius = 24.0
radius = 12.0
[node name="TopHat" type="CharacterBody2D"]
collision_layer = 8