mirror of
https://github.com/Steffo99/hella-farm.git
synced 2024-11-21 15:44:23 +00:00
Merge branch 'main' of https://github.com/Steffo99/ld55
This commit is contained in:
commit
0adbcb405e
18 changed files with 334 additions and 15 deletions
16
behaviours/monster_type.gd
Normal file
16
behaviours/monster_type.gd
Normal file
|
@ -0,0 +1,16 @@
|
|||
@icon("res://behaviours/edible.svg")
|
||||
extends Node
|
||||
class_name MonsterType
|
||||
|
||||
## Emits [signal eaten] when eaten by an [Eater] whose acceptable diets contain this node's [field diet].
|
||||
##
|
||||
## To add multiple possible [Edible] diets to an entity, add multiple [Edible] nodes to it.
|
||||
|
||||
signal sacrificed
|
||||
|
||||
|
||||
@export var type: Enums.MonsterType = Enums.MonsterType.Sheep
|
||||
|
||||
|
||||
func sarcifice():
|
||||
sacrificed.emit()
|
6
behaviours/monster_type.tscn
Normal file
6
behaviours/monster_type.tscn
Normal file
|
@ -0,0 +1,6 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://ccul07w0h36nu"]
|
||||
|
||||
[ext_resource type="Script" path="res://behaviours/monster_type.gd" id="1_6jq3j"]
|
||||
|
||||
[node name="MonsterType" type="Node"]
|
||||
script = ExtResource("1_6jq3j")
|
|
@ -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"]
|
||||
|
||||
|
|
|
@ -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):
|
||||
better_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")
|
||||
|
|
|
@ -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):
|
||||
better_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")
|
||||
|
|
28
entities/sacrifice_stone.gd
Normal file
28
entities/sacrifice_stone.gd
Normal file
|
@ -0,0 +1,28 @@
|
|||
extends Node2D
|
||||
class_name SacrificeStone
|
||||
|
||||
signal sacrifice_changed(entity: Node2D, type: Enums.MonsterType)
|
||||
|
||||
var current_monster: Node2D
|
||||
var current_type: Enums.MonsterType = Enums.MonsterType.None
|
||||
|
||||
func _on_tracked(body: Node2D):
|
||||
if current_monster != null:
|
||||
Log.w(self, "Captured two entities")
|
||||
return
|
||||
|
||||
var types: Array = body.find_children("*", "MonsterType", false, false)
|
||||
for type in types:
|
||||
current_monster = body
|
||||
current_type = type.type
|
||||
sacrifice_changed.emit(current_monster, current_type)
|
||||
break
|
||||
|
||||
if current_monster == null:
|
||||
Log.w(self, "Captured entity with no MonsterType")
|
||||
|
||||
func _on_untracked(body: Node2D):
|
||||
if body == current_monster:
|
||||
current_monster = null
|
||||
current_type = Enums.MonsterType.None
|
||||
sacrifice_changed.emit(current_monster, current_type)
|
BIN
entities/sacrifice_stone.png
(Stored with Git LFS)
Normal file
BIN
entities/sacrifice_stone.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
entities/sacrifice_stone.png.import
Normal file
34
entities/sacrifice_stone.png.import
Normal 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
|
38
entities/sacrifice_stone.tscn
Normal file
38
entities/sacrifice_stone.tscn
Normal file
|
@ -0,0 +1,38 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://4xivigiybb1d"]
|
||||
|
||||
[ext_resource type="Script" path="res://entities/sacrifice_stone.gd" id="1_sgl1t"]
|
||||
[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="Node2D"]
|
||||
script = ExtResource("1_sgl1t")
|
||||
|
||||
[node name="StoneArea" type="Area2D" parent="."]
|
||||
collision_layer = 8
|
||||
collision_mask = 24
|
||||
monitoring = false
|
||||
|
||||
[node name="Shape" type="CollisionShape2D" parent="StoneArea"]
|
||||
shape = SubResource("CircleShape2D_yv6hf")
|
||||
one_way_collision_margin = 27.5
|
||||
|
||||
[node name="Edible" parent="StoneArea" instance=ExtResource("1_y58y4")]
|
||||
diet = &"Trap"
|
||||
|
||||
[node name="SacrificeTracker" parent="StoneArea" instance=ExtResource("2_6m7pn")]
|
||||
collision_mask = 56
|
||||
|
||||
[node name="Sprite" type="Sprite2D" parent="StoneArea/SacrificeTracker"]
|
||||
position = Vector2(0, 22)
|
||||
texture = ExtResource("2_rbklw")
|
||||
|
||||
[node name="Shape" type="CollisionShape2D" parent="StoneArea/SacrificeTracker"]
|
||||
shape = SubResource("CircleShape2D_yv6hf")
|
||||
one_way_collision_margin = 27.5
|
||||
|
||||
[connection signal="tracked" from="StoneArea/SacrificeTracker" to="." method="_on_tracked"]
|
||||
[connection signal="untracked" from="StoneArea/SacrificeTracker" to="." method="_on_untracked"]
|
|
@ -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:
|
||||
better_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")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=26 format=3 uid="uid://bc2bm8lbol18w"]
|
||||
[gd_scene load_steps=30 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"]
|
||||
|
@ -7,6 +7,7 @@
|
|||
[ext_resource type="Texture2D" uid="uid://cfduc7cdorasr" path="res://entities/sheep_drag_left.png" id="5_gh6h6"]
|
||||
[ext_resource type="PackedScene" uid="uid://dfdr3e32lohq" path="res://behaviours/edible.tscn" id="6_3odsh"]
|
||||
[ext_resource type="Texture2D" uid="uid://m5bebwb06kqe" path="res://entities/sheep_drag_right.png" id="6_x4fsj"]
|
||||
[ext_resource type="PackedScene" uid="uid://ccul07w0h36nu" path="res://behaviours/monster_type.tscn" id="8_poavy"]
|
||||
[ext_resource type="PackedScene" uid="uid://djcwis8ycrq85" path="res://behaviours/sampler_priority.tscn" id="9_s5lod"]
|
||||
[ext_resource type="PackedScene" uid="uid://dk1ipq7dhkhf3" path="res://behaviours/move_straight.tscn" id="10_05kcd"]
|
||||
[ext_resource type="PackedScene" uid="uid://cm67ko1k6kn4u" path="res://behaviours/priority.tscn" id="11_0jlmk"]
|
||||
|
@ -17,6 +18,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 +192,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
|
||||
|
@ -219,6 +228,8 @@ blend_times = [&"drag_start", &"drag_loop", 0.5]
|
|||
[node name="Edible" parent="." instance=ExtResource("6_3odsh")]
|
||||
diet = &"Meat"
|
||||
|
||||
[node name="MonsterType" parent="." instance=ExtResource("8_poavy")]
|
||||
|
||||
[node name="MovementSampler" parent="." instance=ExtResource("9_s5lod")]
|
||||
|
||||
[node name="MovementIdle" parent="." instance=ExtResource("10_05kcd")]
|
||||
|
@ -277,6 +288,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 = 600.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 +315,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 +344,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]
|
||||
|
|
48
entities/summoning_circle.gd
Normal file
48
entities/summoning_circle.gd
Normal file
|
@ -0,0 +1,48 @@
|
|||
extends Node2D
|
||||
class_name SacrificeCircle
|
||||
|
||||
@onready var spawner: Spawner = $"Spawner"
|
||||
|
||||
## The scene to spawn.
|
||||
@export var scene_imp: PackedScene
|
||||
|
||||
|
||||
var stones: Array[SacrificeStone]
|
||||
var sacrifices: Array[Enums.MonsterType]
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
stones = []
|
||||
sacrifices = []
|
||||
stones.assign(find_children("*", "SacrificeStone", true, false))
|
||||
|
||||
for stone in stones:
|
||||
sacrifices.append(stone.current_type)
|
||||
|
||||
func refresh_sacrifices() -> void:
|
||||
for i in len(stones):
|
||||
sacrifices[i] = stones[i].current_type
|
||||
|
||||
func try_sacrifice() -> void:
|
||||
var first_monster = sacrifices[0]
|
||||
var all_same = true
|
||||
for m in sacrifices:
|
||||
if m != first_monster:
|
||||
all_same = false
|
||||
break
|
||||
if not all_same:
|
||||
return
|
||||
|
||||
if first_monster == Enums.MonsterType.Sheep:
|
||||
spawn(scene_imp)
|
||||
|
||||
func spawn(type: PackedScene) -> void:
|
||||
spawner.scene = type
|
||||
spawner.spawn()
|
||||
|
||||
for s in stones:
|
||||
s.current_monster.queue_free()
|
||||
|
||||
func _on_sacrifice_changed(_entity: Node2D, _type: Enums.MonsterType):
|
||||
refresh_sacrifices()
|
||||
try_sacrifice()
|
BIN
entities/summoning_circle.png
(Stored with Git LFS)
Normal file
BIN
entities/summoning_circle.png
(Stored with Git LFS)
Normal file
Binary file not shown.
34
entities/summoning_circle.png.import
Normal file
34
entities/summoning_circle.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://n0wj20mduwy8"
|
||||
path="res://.godot/imported/summoning_circle.png-a9e8e58bff05ee4e15de5d48253b8a5d.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://entities/summoning_circle.png"
|
||||
dest_files=["res://.godot/imported/summoning_circle.png-a9e8e58bff05ee4e15de5d48253b8a5d.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
|
39
entities/summoning_circle.tscn
Normal file
39
entities/summoning_circle.tscn
Normal file
|
@ -0,0 +1,39 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://uoopwyh1ea7t"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://n0wj20mduwy8" path="res://entities/summoning_circle.png" id="1_c6jmb"]
|
||||
[ext_resource type="Script" path="res://entities/summoning_circle.gd" id="1_x3bxd"]
|
||||
[ext_resource type="PackedScene" uid="uid://4d3ksr3171x4" path="res://entities/imp.tscn" id="2_48rxv"]
|
||||
[ext_resource type="PackedScene" uid="uid://4xivigiybb1d" path="res://entities/sacrifice_stone.tscn" id="2_dwkfn"]
|
||||
[ext_resource type="PackedScene" uid="uid://tx1qi6ahlxjp" path="res://behaviours/spawner.tscn" id="3_p6s0q"]
|
||||
|
||||
[node name="SummoningCircle" type="Node2D"]
|
||||
script = ExtResource("1_x3bxd")
|
||||
scene_imp = ExtResource("2_48rxv")
|
||||
|
||||
[node name="Demoncircle" type="Sprite2D" parent="."]
|
||||
position = Vector2(2, 4)
|
||||
scale = Vector2(2, 2)
|
||||
texture = ExtResource("1_c6jmb")
|
||||
|
||||
[node name="Spawner" parent="." instance=ExtResource("3_p6s0q")]
|
||||
|
||||
[node name="S1" parent="." instance=ExtResource("2_dwkfn")]
|
||||
position = Vector2(-79, -45)
|
||||
|
||||
[node name="S2" parent="." instance=ExtResource("2_dwkfn")]
|
||||
position = Vector2(0, -85)
|
||||
|
||||
[node name="S3" parent="." instance=ExtResource("2_dwkfn")]
|
||||
position = Vector2(-77, 44)
|
||||
|
||||
[node name="S4" parent="." instance=ExtResource("2_dwkfn")]
|
||||
position = Vector2(80, 44)
|
||||
|
||||
[node name="S5" parent="." instance=ExtResource("2_dwkfn")]
|
||||
position = Vector2(77, -45)
|
||||
|
||||
[connection signal="sacrifice_changed" from="S1" to="." method="_on_sacrifice_changed"]
|
||||
[connection signal="sacrifice_changed" from="S2" to="." method="_on_sacrifice_changed"]
|
||||
[connection signal="sacrifice_changed" from="S3" to="." method="_on_sacrifice_changed"]
|
||||
[connection signal="sacrifice_changed" from="S4" to="." method="_on_sacrifice_changed"]
|
||||
[connection signal="sacrifice_changed" from="S5" to="." method="_on_sacrifice_changed"]
|
|
@ -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):
|
||||
better_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")
|
||||
|
|
19
enums.gd
Normal file
19
enums.gd
Normal file
|
@ -0,0 +1,19 @@
|
|||
extends Node
|
||||
|
||||
class_name Enums
|
||||
|
||||
enum ZIndex {
|
||||
EntityAir = 20,
|
||||
EntityGround = 10,
|
||||
Props = 0,
|
||||
Terrain = -10,
|
||||
}
|
||||
|
||||
enum MonsterType {
|
||||
None = 0, # I hate this but in GDScript enums can't be nulls and there aren't any sum types like in rust so this is all we can do
|
||||
Sheep,
|
||||
Imp,
|
||||
Chupacapra,
|
||||
Watcher,
|
||||
Chtulu,
|
||||
}
|
|
@ -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://uoopwyh1ea7t" path="res://entities/summoning_circle.tscn" id="16_v1vce"]
|
||||
|
||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_058kb"]
|
||||
texture = ExtResource("2_o7bg5")
|
||||
|
@ -936,13 +937,15 @@ position = Vector2(-211, 241)
|
|||
position = Vector2(-491, 137)
|
||||
|
||||
[node name="Sheep7" parent="." instance=ExtResource("9_qrqqu")]
|
||||
position = Vector2(-177, 154)
|
||||
position = Vector2(63, -115)
|
||||
|
||||
[node name="Chupacabra" parent="." instance=ExtResource("11_ixo4x")]
|
||||
position = Vector2(6, -210)
|
||||
|
||||
[node name="Watcher" parent="." instance=ExtResource("14_8rumi")]
|
||||
position = Vector2(189, 171)
|
||||
position = Vector2(316, 224)
|
||||
|
||||
[node name="Cthulhu" parent="." instance=ExtResource("15_k41qf")]
|
||||
position = Vector2(226, -137)
|
||||
|
||||
[node name="SummoningCircle" parent="." instance=ExtResource("16_v1vce")]
|
||||
|
|
Loading…
Reference in a new issue