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

Add sacrifical stone for sheeps & ZIndex enum

This commit is contained in:
Lorenzo Rossi 2024-04-27 15:32:57 +02:00
parent bad1bec1c4
commit 4944333706
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 43733C54D7B7BD75
12 changed files with 196 additions and 67 deletions

View file

@ -2,7 +2,7 @@
[ext_resource type="Script" path="res://entities/cloud.gd" id="1_8jsek"]
[ext_resource type="PackedScene" uid="uid://bc2bm8lbol18w" path="res://entities/sheep.tscn" id="3_naxi5"]
[ext_resource type="PackedScene" path="res://behaviours/spawner.tscn" id="4_0cics"]
[ext_resource type="PackedScene" uid="uid://tx1qi6ahlxjp" path="res://behaviours/spawner.tscn" id="4_0cics"]
[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_08frh"]

View file

@ -5,6 +5,9 @@ class_name Cthulhu
@onready var sprite: SpriteLeftRight = %"Sprite"
@onready var animator: AnimationPlayer = %"Animator"
func _ready():
# Setup index and layers
_on_fallen()
func _on_move(movement: Vector2):
move_and_collide(movement)
@ -13,11 +16,11 @@ func _on_move(movement: Vector2):
func _on_dragged(_cursor: Cursor) -> void:
collision_layer = 16
collision_mask = 18
z_index = 1
z_index = Enums.ZIndex.EntityAir
animator.play(&"drag_start")
func _on_fallen() -> void:
collision_layer = 8
collision_mask = 14
z_index = 0
z_index = Enums.ZIndex.EntityGround
animator.play(&"RESET")

View file

@ -68,58 +68,6 @@ tracks/3/keys = {
"values": [0.0]
}
[sub_resource type="Animation" id="Animation_qhrn0"]
resource_name = "drag_start"
length = 0.4
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("SpriteFocus/Sprite:scale")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.4),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(2, 2), Vector2(2.4, 2.4)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("SpriteFocus/Sprite:left_texture")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [ExtResource("5_6ho60")]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("SpriteFocus/Sprite:right_texture")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [ExtResource("6_behik")]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("SpriteFocus:rotation")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
[sub_resource type="Animation" id="Animation_iyn5h"]
resource_name = "drag_loop"
length = 2.0
@ -173,6 +121,58 @@ tracks/3/keys = {
"values": [-0.10472, 0.10472]
}
[sub_resource type="Animation" id="Animation_qhrn0"]
resource_name = "drag_start"
length = 0.4
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("SpriteFocus/Sprite:scale")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.4),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Vector2(2, 2), Vector2(2.4, 2.4)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("SpriteFocus/Sprite:left_texture")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [ExtResource("5_6ho60")]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("SpriteFocus/Sprite:right_texture")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [ExtResource("6_behik")]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("SpriteFocus:rotation")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_clmy5"]
_data = {
"RESET": SubResource("Animation_aspa2"),
@ -207,8 +207,8 @@ unique_name_in_owner = true
libraries = {
"": SubResource("AnimationLibrary_clmy5")
}
next/drag_start = &"drag_loop"
next/drag_loop = &"drag_loop"
next/drag_start = &"drag_loop"
blend_times = [&"drag_start", &"drag_loop", 0.5]
[node name="MovementSampler" parent="." instance=ExtResource("6_truco")]

View file

@ -7,6 +7,10 @@ class_name Imp
@onready var animator: AnimationPlayer = %"Animator"
func _ready():
# Setup index and layers
_on_fallen()
func _on_move(movement: Vector2):
move_and_collide(movement)
sprite.handle_move(movement)
@ -17,13 +21,13 @@ func _on_eater_eaten(edible: Edible) -> void:
func _on_dragged(_cursor: Cursor) -> void:
collision_layer = 16
collision_mask = 18
z_index = 1
z_index = Enums.ZIndex.EntityAir
eater.collision_mask = 16
animator.play(&"drag_start")
func _on_fallen() -> void:
collision_layer = 8
collision_mask = 14
z_index = 0
z_index = Enums.ZIndex.EntityGround
eater.collision_mask = 8
animator.play(&"RESET")

BIN
entities/sacrifice_stone.png (Stored with Git LFS) Normal file

Binary file not shown.

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://d3pn6wuykchoa"
path="res://.godot/imported/sacrifice_stone.png-0fef76a78cc081454c5c39661806c5e9.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://entities/sacrifice_stone.png"
dest_files=["res://.godot/imported/sacrifice_stone.png-0fef76a78cc081454c5c39661806c5e9.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View file

@ -0,0 +1,32 @@
[gd_scene load_steps=5 format=3 uid="uid://4xivigiybb1d"]
[ext_resource type="PackedScene" uid="uid://dfdr3e32lohq" path="res://behaviours/edible.tscn" id="1_y58y4"]
[ext_resource type="PackedScene" uid="uid://c5pyp5hvthdof" path="res://behaviours/tracker_tracker.tscn" id="2_6m7pn"]
[ext_resource type="Texture2D" uid="uid://d3pn6wuykchoa" path="res://entities/sacrifice_stone.png" id="2_rbklw"]
[sub_resource type="CircleShape2D" id="CircleShape2D_yv6hf"]
radius = 0.01
[node name="SacrificeStone" type="Area2D"]
position = Vector2(50, 50)
collision_layer = 8
collision_mask = 24
monitoring = false
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_yv6hf")
one_way_collision_margin = 27.5
[node name="Edible" parent="." instance=ExtResource("1_y58y4")]
diet = &"Trap"
[node name="SacrStone" parent="." instance=ExtResource("2_6m7pn")]
collision_mask = 56
[node name="Sprite" type="Sprite2D" parent="SacrStone"]
position = Vector2(0, 22)
texture = ExtResource("2_rbklw")
[node name="CollisionShape2D" type="CollisionShape2D" parent="SacrStone"]
shape = SubResource("CircleShape2D_yv6hf")
one_way_collision_margin = 27.5

View file

@ -5,6 +5,9 @@ class_name Sheep
@onready var sprite: SpriteLeftRight = %"Sprite"
@onready var animator: AnimationPlayer = %"Animator"
func _ready():
# Setup index and layers
_on_fallen()
func _on_move(movement: Vector2) -> void:
move_and_collide(movement)
@ -13,11 +16,11 @@ func _on_move(movement: Vector2) -> void:
func _on_dragged(_cursor: Cursor) -> void:
collision_layer = 16
collision_mask = 18
z_index = 1
z_index = Enums.ZIndex.EntityAir
animator.play(&"drag_start")
func _on_fallen() -> void:
collision_layer = 8
collision_mask = 14
z_index = 0
z_index = Enums.ZIndex.EntityGround
animator.play(&"RESET")

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=26 format=3 uid="uid://bc2bm8lbol18w"]
[gd_scene load_steps=29 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"]
@ -17,6 +17,7 @@
[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="PackedScene" uid="uid://ctpn4hvkhxoi3" path="res://behaviours/tracker_edible.tscn" id="16_6h84f"]
[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"]
@ -190,7 +191,14 @@ _data = {
[sub_resource type="CircleShape2D" id="CircleShape2D_etpf6"]
radius = 144.0
[sub_resource type="CircleShape2D" id="CircleShape2D_nn3xr"]
radius = 25.19
[sub_resource type="CircleShape2D" id="CircleShape2D_bct1e"]
radius = 8.65
[node name="Sheep" type="CharacterBody2D"]
z_index = 1
collision_layer = 8
collision_mask = 14
motion_mode = 1
@ -277,6 +285,23 @@ debug_color = Color(1, 1, 0, 0)
[node name="TargetPicker" parent="MovementRunFromHunter/HunterSense" node_paths=PackedStringArray("tracker") instance=ExtResource("13_jf6em")]
tracker = NodePath("..")
[node name="MovementTrap" parent="." instance=ExtResource("12_x2g3x")]
speed = 140.0
enabled = false
[node name="TrapPriority" parent="MovementTrap" instance=ExtResource("11_0jlmk")]
alternative_priority = 45
[node name="TrackerMeat" parent="MovementTrap" instance=ExtResource("16_6h84f")]
acceptable_diets = Array[StringName]([&"Trap"])
[node name="Shape" type="CollisionShape2D" parent="MovementTrap/TrackerMeat"]
shape = SubResource("CircleShape2D_nn3xr")
debug_color = Color(1, 0.498039, 0, 0)
[node name="TargetPicker" parent="MovementTrap/TrackerMeat" node_paths=PackedStringArray("tracker") instance=ExtResource("13_jf6em")]
tracker = NodePath("..")
[node name="MovementDrag" parent="." instance=ExtResource("14_3wojv")]
enabled = false
@ -287,7 +312,7 @@ alternative_priority = 50
[node name="Shape" type="CollisionShape2D" parent="MovementDrag/Draggable"]
scale = Vector2(3, 3)
shape = SubResource("CircleShape2D_c5tcn")
shape = SubResource("CircleShape2D_bct1e")
debug_color = Color(1, 1, 1, 0)
[node name="DragSound" type="AudioStreamPlayer2D" parent="MovementDrag"]
@ -316,6 +341,14 @@ stream = ExtResource("17_8kst2")
[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="changed_target" from="MovementTrap" to="MovementTrap/TrapPriority" method="priority_conditional"]
[connection signal="move" from="MovementTrap" to="." method="_on_move"]
[connection signal="area_entered" from="MovementTrap/TrackerMeat" to="MovementTrap/TrackerMeat" method="check_diet_then_track"]
[connection signal="area_exited" from="MovementTrap/TrackerMeat" to="MovementTrap/TrackerMeat" method="untrack"]
[connection signal="tracked" from="MovementTrap/TrackerMeat" to="MovementTrap/TrackerMeat/TargetPicker" method="sample_target_if_null" unbinds=1]
[connection signal="untracked" from="MovementTrap/TrackerMeat" to="MovementTrap/TrackerMeat/TargetPicker" method="clear_if_target"]
[connection signal="target_changed" from="MovementTrap/TrackerMeat/TargetPicker" to="MovementTrap" method="set_target" unbinds=1]
[connection signal="target_changed" from="MovementTrap/TrackerMeat/TargetPicker" to="MovementTrap/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]

View file

@ -5,7 +5,9 @@ class_name Watcher
@onready var sprite: SpriteLeftRight = %"Sprite"
@onready var animator: AnimationPlayer = %"Animator"
func _ready():
# Setup index and layers
_on_fallen()
func _on_move(movement: Vector2):
move_and_collide(movement)
@ -14,11 +16,11 @@ func _on_move(movement: Vector2):
func _on_dragged(_cursor: Cursor) -> void:
collision_layer = 16
collision_mask = 18
z_index = 1
z_index = Enums.ZIndex.EntityAir
animator.play(&"drag_start")
func _on_fallen() -> void:
collision_layer = 8
collision_mask = 14
z_index = 0
z_index = Enums.ZIndex.EntityGround
animator.play(&"RESET")

10
enums.gd Normal file
View file

@ -0,0 +1,10 @@
extends Node
class_name Enums
enum ZIndex {
EntityAir = 20,
EntityGround = 10,
Props = 0,
Terrain = -10,
}

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=21 format=3 uid="uid://cxj5aud02f40j"]
[gd_scene load_steps=22 format=3 uid="uid://cxj5aud02f40j"]
[ext_resource type="Script" path="res://scenes/game/main_game.gd" id="1_wiglu"]
[ext_resource type="PackedScene" uid="uid://dm068vaseh45n" path="res://scenes/game/game_camera.tscn" id="2_db5xs"]
@ -15,6 +15,7 @@
[ext_resource type="PackedScene" uid="uid://cmemgijh6nfmk" path="res://entities/chupacabra.tscn" id="11_ixo4x"]
[ext_resource type="PackedScene" uid="uid://dnjtduk0hla3f" path="res://entities/watcher.tscn" id="14_8rumi"]
[ext_resource type="PackedScene" uid="uid://gl4umoff474y" path="res://entities/cthulhu.tscn" id="15_k41qf"]
[ext_resource type="PackedScene" uid="uid://4xivigiybb1d" path="res://entities/sacrifice_stone.tscn" id="16_674vn"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_058kb"]
texture = ExtResource("2_o7bg5")
@ -936,7 +937,7 @@ position = Vector2(-211, 241)
position = Vector2(-491, 137)
[node name="Sheep7" parent="." instance=ExtResource("9_qrqqu")]
position = Vector2(-177, 154)
position = Vector2(87, 40)
[node name="Chupacabra" parent="." instance=ExtResource("11_ixo4x")]
position = Vector2(6, -210)
@ -946,3 +947,7 @@ position = Vector2(189, 171)
[node name="Cthulhu" parent="." instance=ExtResource("15_k41qf")]
position = Vector2(226, -137)
[node name="SacrificeStone" parent="." instance=ExtResource("16_674vn")]
[editable path="SacrificeStone"]