mirror of
https://github.com/Steffo99/hella-farm.git
synced 2024-11-27 18:44:23 +00:00
Significantly improve Z indexes
This commit is contained in:
parent
ad6683aaf1
commit
a9ac5714ba
20 changed files with 92 additions and 19 deletions
|
@ -35,3 +35,9 @@ func _on_fallen() -> void:
|
|||
z_index = 0
|
||||
eater.collision_mask = 8
|
||||
animator.play(&"RESET")
|
||||
|
||||
func _on_trapped() -> void:
|
||||
z_index = Enums.ZIndex.EntitySacrifice
|
||||
|
||||
func _on_freed() -> void:
|
||||
z_index = Enums.ZIndex.EntityGround
|
||||
|
|
|
@ -355,6 +355,7 @@ radius = 32.0
|
|||
radius = 40.0
|
||||
|
||||
[node name="Chupacabra" type="CharacterBody2D"]
|
||||
y_sort_enabled = true
|
||||
collision_layer = 8
|
||||
collision_mask = 14
|
||||
motion_mode = 1
|
||||
|
@ -363,6 +364,7 @@ skitter_directions = Array[Vector2]([Vector2(-1, 0), Vector2(1, 0)])
|
|||
|
||||
[node name="Sprite" parent="." instance=ExtResource("1_11voy")]
|
||||
unique_name_in_owner = true
|
||||
y_sort_enabled = true
|
||||
scale = Vector2(2, 2)
|
||||
texture = ExtResource("2_3kvme")
|
||||
left_texture = ExtResource("2_3kvme")
|
||||
|
|
|
@ -184,6 +184,7 @@ _data = {
|
|||
radius = 50.0
|
||||
|
||||
[node name="Cthulhu" type="CharacterBody2D"]
|
||||
y_sort_enabled = true
|
||||
collision_layer = 8
|
||||
collision_mask = 14
|
||||
script = ExtResource("1_b55wc")
|
||||
|
@ -192,6 +193,7 @@ script = ExtResource("1_b55wc")
|
|||
|
||||
[node name="Sprite" parent="SpriteFocus" instance=ExtResource("1_a8ato")]
|
||||
unique_name_in_owner = true
|
||||
y_sort_enabled = true
|
||||
position = Vector2(0, 48)
|
||||
scale = Vector2(2, 2)
|
||||
texture = ExtResource("2_13vnj")
|
||||
|
|
|
@ -14,6 +14,8 @@ radius = 96.0
|
|||
[sub_resource type="CircleShape2D" id="CircleShape2D_jm7yp"]
|
||||
|
||||
[node name="Gold" type="Node2D"]
|
||||
z_index = -5
|
||||
y_sort_enabled = true
|
||||
script = ExtResource("1_lbls1")
|
||||
|
||||
[node name="Collectible" parent="." instance=ExtResource("2_j75yq")]
|
||||
|
@ -21,6 +23,7 @@ unique_name_in_owner = true
|
|||
kind = &"Gold"
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
y_sort_enabled = true
|
||||
scale = Vector2(2, 2)
|
||||
texture = ExtResource("2_tt3v6")
|
||||
|
||||
|
|
|
@ -31,3 +31,9 @@ func _on_fallen() -> void:
|
|||
z_index = Enums.ZIndex.EntityGround
|
||||
eater.collision_mask = 8
|
||||
animator.play(&"RESET")
|
||||
|
||||
func _on_trapped() -> void:
|
||||
z_index = Enums.ZIndex.EntitySacrifice
|
||||
|
||||
func _on_freed() -> void:
|
||||
z_index = Enums.ZIndex.EntityGround
|
||||
|
|
|
@ -225,6 +225,7 @@ radius = 32.0
|
|||
radius = 40.0
|
||||
|
||||
[node name="Imp" type="CharacterBody2D"]
|
||||
y_sort_enabled = true
|
||||
collision_layer = 8
|
||||
collision_mask = 14
|
||||
motion_mode = 1
|
||||
|
@ -232,6 +233,7 @@ script = ExtResource("1_dixpc")
|
|||
|
||||
[node name="Sprite" parent="." instance=ExtResource("2_eqcdi")]
|
||||
unique_name_in_owner = true
|
||||
y_sort_enabled = true
|
||||
scale = Vector2(2, 2)
|
||||
texture = ExtResource("3_qda0k")
|
||||
left_texture = ExtResource("3_qda0k")
|
||||
|
@ -296,6 +298,7 @@ debug_color = Color(1, 0.498039, 0, 0)
|
|||
tracker = NodePath("..")
|
||||
|
||||
[node name="MovementTrap" parent="." instance=ExtResource("11_4ra22")]
|
||||
y_sort_enabled = true
|
||||
speed = 600.0
|
||||
enabled = false
|
||||
|
||||
|
|
|
@ -11,11 +11,17 @@ 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")
|
||||
|
||||
func _on_trapped() -> void:
|
||||
z_index = Enums.ZIndex.EntitySacrifice
|
||||
|
||||
func _on_freed() -> void:
|
||||
z_index = Enums.ZIndex.EntityGround
|
||||
|
|
|
@ -105,12 +105,14 @@ _data = {
|
|||
radius = 12.0
|
||||
|
||||
[node name="Monocle" type="CharacterBody2D"]
|
||||
y_sort_enabled = true
|
||||
collision_layer = 8
|
||||
collision_mask = 14
|
||||
motion_mode = 1
|
||||
script = ExtResource("1_ehpfj")
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
y_sort_enabled = true
|
||||
scale = Vector2(2, 2)
|
||||
texture = ExtResource("1_omrit")
|
||||
|
||||
|
|
|
@ -6,18 +6,19 @@
|
|||
[ext_resource type="Texture2D" uid="uid://d3pn6wuykchoa" path="res://entities/sacrifice_stone.png" id="2_rbklw"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_yv6hf"]
|
||||
radius = 4.0
|
||||
radius = 8.0
|
||||
|
||||
[node name="SacrificeStone" type="Node2D"]
|
||||
y_sort_enabled = true
|
||||
script = ExtResource("1_sgl1t")
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
z_index = 5
|
||||
position = Vector2(0, 32)
|
||||
y_sort_enabled = true
|
||||
scale = Vector2(2, 2)
|
||||
texture = ExtResource("2_rbklw")
|
||||
|
||||
[node name="StoneArea" type="Area2D" parent="."]
|
||||
position = Vector2(0, -29)
|
||||
collision_layer = 8
|
||||
collision_mask = 0
|
||||
monitoring = false
|
||||
|
|
|
@ -5,6 +5,7 @@ class_name Sheep
|
|||
@onready var sprite: SpriteLeftRight = %"Sprite"
|
||||
@onready var animator: AnimationPlayer = %"Animator"
|
||||
|
||||
|
||||
func _ready():
|
||||
# Setup index and layers
|
||||
_on_fallen()
|
||||
|
@ -24,3 +25,9 @@ func _on_fallen() -> void:
|
|||
collision_mask = 14
|
||||
z_index = Enums.ZIndex.EntityGround
|
||||
animator.play(&"RESET")
|
||||
|
||||
func _on_trapped() -> void:
|
||||
z_index = Enums.ZIndex.EntitySacrifice
|
||||
|
||||
func _on_freed() -> void:
|
||||
z_index = Enums.ZIndex.EntityGround
|
||||
|
|
|
@ -200,6 +200,7 @@ radius = 8.65
|
|||
|
||||
[node name="Sheep" type="CharacterBody2D"]
|
||||
z_index = 1
|
||||
y_sort_enabled = true
|
||||
collision_layer = 8
|
||||
collision_mask = 14
|
||||
motion_mode = 1
|
||||
|
@ -349,6 +350,8 @@ stream = ExtResource("17_8kst2")
|
|||
[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="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]
|
||||
|
|
|
@ -11,11 +11,17 @@ 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")
|
||||
|
||||
func _on_trapped() -> void:
|
||||
z_index = Enums.ZIndex.EntitySacrifice
|
||||
|
||||
func _on_freed() -> void:
|
||||
z_index = Enums.ZIndex.EntityGround
|
||||
|
|
|
@ -105,12 +105,14 @@ _data = {
|
|||
radius = 12.0
|
||||
|
||||
[node name="Skull" type="CharacterBody2D"]
|
||||
y_sort_enabled = true
|
||||
collision_layer = 8
|
||||
collision_mask = 14
|
||||
motion_mode = 1
|
||||
script = ExtResource("1_7g8bu")
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
y_sort_enabled = true
|
||||
position = Vector2(2, 0)
|
||||
scale = Vector2(2, 2)
|
||||
texture = ExtResource("1_v6qk3")
|
||||
|
|
|
@ -11,29 +11,32 @@
|
|||
[ext_resource type="PackedScene" uid="uid://gl4umoff474y" path="res://entities/cthulhu.tscn" id="9_wli14"]
|
||||
|
||||
[node name="SummoningCirclePentagram" type="Node2D"]
|
||||
y_sort_enabled = true
|
||||
script = ExtResource("1_l5mec")
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
z_index = -10
|
||||
position = Vector2(2, 4)
|
||||
scale = Vector2(2, 2)
|
||||
texture = ExtResource("3_stpdd")
|
||||
|
||||
[node name="Stones" type="Node2D" parent="."]
|
||||
y_sort_enabled = true
|
||||
|
||||
[node name="StoneUp" parent="Stones" instance=ExtResource("4_qyef2")]
|
||||
position = Vector2(0, -108)
|
||||
position = Vector2(0, -76)
|
||||
|
||||
[node name="StoneTopLeft" parent="Stones" instance=ExtResource("4_qyef2")]
|
||||
position = Vector2(-92, -64)
|
||||
position = Vector2(-92, -32)
|
||||
|
||||
[node name="StoneTopRight" parent="Stones" instance=ExtResource("4_qyef2")]
|
||||
position = Vector2(92, -64)
|
||||
position = Vector2(92, -32)
|
||||
|
||||
[node name="StoneBottomLeft" parent="Stones" instance=ExtResource("4_qyef2")]
|
||||
position = Vector2(-75, 30)
|
||||
position = Vector2(-75, 62)
|
||||
|
||||
[node name="StoneBottomRight" parent="Stones" instance=ExtResource("4_qyef2")]
|
||||
position = Vector2(75, 30)
|
||||
position = Vector2(75, 62)
|
||||
|
||||
[node name="Recipes" type="Node" parent="."]
|
||||
|
||||
|
|
|
@ -11,11 +11,17 @@ 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")
|
||||
|
||||
func _on_trapped() -> void:
|
||||
z_index = Enums.ZIndex.EntitySacrifice
|
||||
|
||||
func _on_freed() -> void:
|
||||
z_index = Enums.ZIndex.EntityGround
|
||||
|
|
|
@ -104,12 +104,14 @@ _data = {
|
|||
radius = 12.0
|
||||
|
||||
[node name="TopHat" type="CharacterBody2D"]
|
||||
y_sort_enabled = true
|
||||
collision_layer = 8
|
||||
collision_mask = 14
|
||||
motion_mode = 1
|
||||
script = ExtResource("1_0eh11")
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="."]
|
||||
y_sort_enabled = true
|
||||
scale = Vector2(2, 2)
|
||||
texture = ExtResource("1_gbqic")
|
||||
|
||||
|
|
|
@ -24,3 +24,9 @@ func _on_fallen() -> void:
|
|||
collision_mask = 14
|
||||
z_index = Enums.ZIndex.EntityGround
|
||||
animator.play(&"RESET")
|
||||
|
||||
func _on_trapped() -> void:
|
||||
z_index = Enums.ZIndex.EntitySacrifice
|
||||
|
||||
func _on_freed() -> void:
|
||||
z_index = Enums.ZIndex.EntityGround
|
||||
|
|
|
@ -154,12 +154,14 @@ radius = 25.19
|
|||
radius = 32.0
|
||||
|
||||
[node name="Watcher" type="CharacterBody2D"]
|
||||
y_sort_enabled = true
|
||||
collision_layer = 8
|
||||
collision_mask = 14
|
||||
script = ExtResource("1_brahc")
|
||||
|
||||
[node name="Sprite" parent="." instance=ExtResource("1_thu73")]
|
||||
unique_name_in_owner = true
|
||||
y_sort_enabled = true
|
||||
scale = Vector2(2, 2)
|
||||
texture = ExtResource("2_32yw7")
|
||||
left_texture = ExtResource("2_32yw7")
|
||||
|
|
12
enums.gd
12
enums.gd
|
@ -2,9 +2,11 @@ class_name Enums
|
|||
|
||||
|
||||
enum ZIndex {
|
||||
EntityAir = 20,
|
||||
EntityGround = 10,
|
||||
SacrificeStone = 5,
|
||||
Props = 0,
|
||||
Terrain = -10,
|
||||
EntityAir = 10,
|
||||
EntitySacrifice = 5,
|
||||
EntityGround = 0,
|
||||
Gold = -5,
|
||||
Props = -10,
|
||||
Flowers = -20,
|
||||
Terrain = -30,
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue