From 31dc930ec12f7c3ab233415cd8c32bd62aeeb891 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 1 May 2024 05:01:38 +0200 Subject: [PATCH] Add barn Co-authored-by: Maxim Lobovsky --- behaviours/spawner.gd | 1 + entities/barn.gd | 33 ++ entities/barn.tscn | 489 ++++++++++++++++++++++++++++ entities/barn_coin_drop.ogg | 3 + entities/barn_coin_drop.ogg.import | 19 ++ entities/barn_coin_enter.ogg | 3 + entities/barn_coin_enter.ogg.import | 19 ++ entities/barn_roof_back.png | 3 + entities/barn_roof_back.png.import | 34 ++ entities/barn_roof_front.png | 3 + entities/barn_roof_front.png.import | 34 ++ entities/barn_wall_back.png | 3 + entities/barn_wall_back.png.import | 34 ++ entities/barn_wall_front.png | 3 + entities/barn_wall_front.png.import | 34 ++ entities/chupacabra.gd | 6 + entities/cthulhu.gd | 6 + entities/imp.gd | 6 + entities/sheep.gd | 6 + entities/sheep.tscn | 16 + entities/watcher.tscn | 50 ++- scenes/game/main_game.tscn | 6 +- 22 files changed, 809 insertions(+), 2 deletions(-) create mode 100644 entities/barn.gd create mode 100644 entities/barn.tscn create mode 100644 entities/barn_coin_drop.ogg create mode 100644 entities/barn_coin_drop.ogg.import create mode 100644 entities/barn_coin_enter.ogg create mode 100644 entities/barn_coin_enter.ogg.import create mode 100644 entities/barn_roof_back.png create mode 100644 entities/barn_roof_back.png.import create mode 100644 entities/barn_roof_front.png create mode 100644 entities/barn_roof_front.png.import create mode 100644 entities/barn_wall_back.png create mode 100644 entities/barn_wall_back.png.import create mode 100644 entities/barn_wall_front.png create mode 100644 entities/barn_wall_front.png.import diff --git a/behaviours/spawner.gd b/behaviours/spawner.gd index 382e68c..55b9651 100644 --- a/behaviours/spawner.gd +++ b/behaviours/spawner.gd @@ -41,4 +41,5 @@ func spawn(): var entity = scene.instantiate() entity.global_position = global_position target.add_child.call_deferred(entity) # Not sure why this is needed. + spawned.emit(entity) return entity diff --git a/entities/barn.gd b/entities/barn.gd new file mode 100644 index 0000000..d487070 --- /dev/null +++ b/entities/barn.gd @@ -0,0 +1,33 @@ +extends StaticBody2D +class_name Barn + + +signal coin_inserted + + +@onready var sheep_spawner: Spawner = %"SheepSpawner" +@onready var blocked_tracker: Tracker = %"BlockedTracker" +@onready var animator: AnimationPlayer = %"Animator" +@onready var game := MainGame.get_via_group(self) + + +func _on_roof_input(_viewport: Node, event: InputEvent, _shape_idx: int) -> void: + var gold_counter = game.inventory.get_counter(&"Gold") + if gold_counter.value < 5: + return + if blocked_tracker.tracking: + return + if not event is InputEventMouseButton: + return + if not event.pressed: + return + gold_counter.decrease(5) + animator.play(&"coin") + +func _on_animation_finished(anim_name:StringName) -> void: + if anim_name == &"coin": + coin_inserted.emit() + +func _on_sheep_spawned(entity: Node2D) -> void: + Log.p(self, "%s" % entity) + entity.get_node("MovementBarn/BarnPriority").priority_alternative() diff --git a/entities/barn.tscn b/entities/barn.tscn new file mode 100644 index 0000000..f449c3e --- /dev/null +++ b/entities/barn.tscn @@ -0,0 +1,489 @@ +[gd_scene load_steps=20 format=3 uid="uid://cn0p5s44h86px"] + +[ext_resource type="Texture2D" uid="uid://bihburr5m7inq" path="res://entities/barn_wall_front.png" id="1_4a825"] +[ext_resource type="Script" path="res://entities/barn.gd" id="1_ny8oq"] +[ext_resource type="Texture2D" uid="uid://p6vg6dgj4ypb" path="res://entities/barn_wall_back.png" id="2_86ic0"] +[ext_resource type="Texture2D" uid="uid://bjg4c6uxwasiw" path="res://entities/barn_roof_front.png" id="3_l2mr8"] +[ext_resource type="Texture2D" uid="uid://ch44qud0c5alj" path="res://entities/barn_roof_back.png" id="4_2rw2x"] +[ext_resource type="PackedScene" uid="uid://8jkesanu4hrn" path="res://behaviours/tracker.tscn" id="6_x01u8"] +[ext_resource type="PackedScene" uid="uid://tx1qi6ahlxjp" path="res://behaviours/spawner.tscn" id="7_07yq6"] +[ext_resource type="AudioStream" uid="uid://yxokdio25nm8" path="res://entities/barn_coin_enter.ogg" id="7_ecg3r"] +[ext_resource type="PackedScene" uid="uid://bc2bm8lbol18w" path="res://entities/sheep.tscn" id="8_kgtsi"] +[ext_resource type="AudioStream" uid="uid://dbj3ctst1tbuo" path="res://entities/barn_coin_drop.ogg" id="8_smljs"] +[ext_resource type="Texture2D" uid="uid://bfl0tkg85cvb8" path="res://entities/gold.png" id="9_4flhr"] + +[sub_resource type="Animation" id="Animation_p5d5r"] +resource_name = "coin" +length = 2.0 +step = 0.13 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Coins/Coin1:visible") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [true] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Coins/Coin1:position") +tracks/1/interp = 2 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0, 0.52), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Vector2(0, 0), Vector2(0, 56)] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("Coins/Coin2:visible") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0, 0.26), +"transitions": PackedFloat32Array(1, 1), +"update": 1, +"values": [false, true] +} +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("Coins/Coin2:position") +tracks/3/interp = 2 +tracks/3/loop_wrap = true +tracks/3/keys = { +"times": PackedFloat32Array(0.26, 0.78), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Vector2(0, 0), Vector2(0, 56)] +} +tracks/4/type = "value" +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/path = NodePath("Coins/Coin3:visible") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/keys = { +"times": PackedFloat32Array(0, 0.52), +"transitions": PackedFloat32Array(1, 1), +"update": 1, +"values": [false, true] +} +tracks/5/type = "value" +tracks/5/imported = false +tracks/5/enabled = true +tracks/5/path = NodePath("Coins/Coin3:position") +tracks/5/interp = 2 +tracks/5/loop_wrap = true +tracks/5/keys = { +"times": PackedFloat32Array(0.52, 1.04), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Vector2(0, 0), Vector2(0, 56)] +} +tracks/6/type = "value" +tracks/6/imported = false +tracks/6/enabled = true +tracks/6/path = NodePath("Coins/Coin4:visible") +tracks/6/interp = 1 +tracks/6/loop_wrap = true +tracks/6/keys = { +"times": PackedFloat32Array(0, 0.78), +"transitions": PackedFloat32Array(1, 1), +"update": 1, +"values": [false, true] +} +tracks/7/type = "value" +tracks/7/imported = false +tracks/7/enabled = true +tracks/7/path = NodePath("Coins/Coin4:position") +tracks/7/interp = 2 +tracks/7/loop_wrap = true +tracks/7/keys = { +"times": PackedFloat32Array(0.78, 1.3), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Vector2(0, 0), Vector2(0, 56)] +} +tracks/8/type = "value" +tracks/8/imported = false +tracks/8/enabled = true +tracks/8/path = NodePath("Coins/Coin5:visible") +tracks/8/interp = 1 +tracks/8/loop_wrap = true +tracks/8/keys = { +"times": PackedFloat32Array(0, 1.04), +"transitions": PackedFloat32Array(1, 1), +"update": 1, +"values": [false, true] +} +tracks/9/type = "value" +tracks/9/imported = false +tracks/9/enabled = true +tracks/9/path = NodePath("Coins/Coin5:position") +tracks/9/interp = 2 +tracks/9/loop_wrap = true +tracks/9/keys = { +"times": PackedFloat32Array(1.04, 1.56), +"transitions": PackedFloat32Array(1, 1), +"update": 0, +"values": [Vector2(0, 0), Vector2(0, 56)] +} +tracks/10/type = "audio" +tracks/10/imported = false +tracks/10/enabled = true +tracks/10/path = NodePath("Coins/Coin1/Sound1") +tracks/10/interp = 1 +tracks/10/loop_wrap = true +tracks/10/keys = { +"clips": [{ +"end_offset": 0.0, +"start_offset": 0.0, +"stream": ExtResource("7_ecg3r") +}, { +"end_offset": 0.0, +"start_offset": 0.0, +"stream": ExtResource("8_smljs") +}], +"times": PackedFloat32Array(0, 0.52) +} +tracks/10/use_blend = true +tracks/11/type = "audio" +tracks/11/imported = false +tracks/11/enabled = true +tracks/11/path = NodePath("Coins/Coin2/Sound2") +tracks/11/interp = 1 +tracks/11/loop_wrap = true +tracks/11/keys = { +"clips": [{ +"end_offset": 0.0, +"start_offset": 0.0, +"stream": ExtResource("8_smljs") +}], +"times": PackedFloat32Array(0.78) +} +tracks/11/use_blend = true +tracks/12/type = "audio" +tracks/12/imported = false +tracks/12/enabled = true +tracks/12/path = NodePath("Coins/Coin3/Sound3") +tracks/12/interp = 1 +tracks/12/loop_wrap = true +tracks/12/keys = { +"clips": [{ +"end_offset": 0.0, +"start_offset": 0.0, +"stream": ExtResource("8_smljs") +}], +"times": PackedFloat32Array(1.04) +} +tracks/12/use_blend = true +tracks/13/type = "audio" +tracks/13/imported = false +tracks/13/enabled = true +tracks/13/path = NodePath("Coins/Coin4/Sound4") +tracks/13/interp = 1 +tracks/13/loop_wrap = true +tracks/13/keys = { +"clips": [{ +"end_offset": 0.0, +"start_offset": 0.0, +"stream": ExtResource("8_smljs") +}], +"times": PackedFloat32Array(1.3) +} +tracks/13/use_blend = true +tracks/14/type = "audio" +tracks/14/imported = false +tracks/14/enabled = true +tracks/14/path = NodePath("Coins/Coin5/Sound5") +tracks/14/interp = 1 +tracks/14/loop_wrap = true +tracks/14/keys = { +"clips": [{ +"end_offset": 0.0, +"start_offset": 0.0, +"stream": ExtResource("8_smljs") +}], +"times": PackedFloat32Array(1.56) +} +tracks/14/use_blend = true + +[sub_resource type="Animation" id="Animation_ofgwt"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Coins/Coin1:visible") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [false] +} +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("Coins/Coin1:position") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(0, 0)] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("Coins/Coin2:visible") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [false] +} +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("Coins/Coin2:position") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(0, 0)] +} +tracks/4/type = "value" +tracks/4/imported = false +tracks/4/enabled = true +tracks/4/path = NodePath("Coins/Coin3:visible") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [false] +} +tracks/5/type = "value" +tracks/5/imported = false +tracks/5/enabled = true +tracks/5/path = NodePath("Coins/Coin3:position") +tracks/5/interp = 1 +tracks/5/loop_wrap = true +tracks/5/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(0, 0)] +} +tracks/6/type = "value" +tracks/6/imported = false +tracks/6/enabled = true +tracks/6/path = NodePath("Coins/Coin4:visible") +tracks/6/interp = 1 +tracks/6/loop_wrap = true +tracks/6/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [false] +} +tracks/7/type = "value" +tracks/7/imported = false +tracks/7/enabled = true +tracks/7/path = NodePath("Coins/Coin4:position") +tracks/7/interp = 1 +tracks/7/loop_wrap = true +tracks/7/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(0, 0)] +} +tracks/8/type = "value" +tracks/8/imported = false +tracks/8/enabled = true +tracks/8/path = NodePath("Coins/Coin5:visible") +tracks/8/interp = 1 +tracks/8/loop_wrap = true +tracks/8/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [false] +} +tracks/9/type = "value" +tracks/9/imported = false +tracks/9/enabled = true +tracks/9/path = NodePath("Coins/Coin5:position") +tracks/9/interp = 1 +tracks/9/loop_wrap = true +tracks/9/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(0, 0)] +} + +[sub_resource type="AnimationLibrary" id="AnimationLibrary_vvq7g"] +_data = { +"RESET": SubResource("Animation_ofgwt"), +"coin": SubResource("Animation_p5d5r") +} + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_7lwl1"] +size = Vector2(132, 2) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_l8xvy"] +size = Vector2(132, 2) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_cpwqc"] +size = Vector2(11, 62) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_1bxxn"] +size = Vector2(140, 38) + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_0ike4"] +size = Vector2(121, 62) + +[node name="Barn" type="StaticBody2D"] +collision_layer = 88 +collision_mask = 4 +script = ExtResource("1_ny8oq") + +[node name="BarnWallFront" type="Sprite2D" parent="."] +position = Vector2(8, -58) +scale = Vector2(2, 2) +texture = ExtResource("1_4a825") + +[node name="BarnWallBack" type="Sprite2D" parent="."] +z_index = -10 +position = Vector2(8, -58) +scale = Vector2(2, 2) +texture = ExtResource("2_86ic0") + +[node name="BarnRoofFront" type="Sprite2D" parent="."] +position = Vector2(8, -58) +scale = Vector2(2, 2) +texture = ExtResource("3_l2mr8") + +[node name="BarnRoofBack" type="Sprite2D" parent="."] +z_index = -10 +position = Vector2(8, -58) +scale = Vector2(2, 2) +texture = ExtResource("4_2rw2x") + +[node name="Coins" type="Node2D" parent="."] +clip_children = 1 +position = Vector2(58, -128) +scale = Vector2(2, 2) + +[node name="Coin1" type="Sprite2D" parent="Coins"] +visible = false +z_index = -5 +texture = ExtResource("9_4flhr") + +[node name="Sound1" type="AudioStreamPlayer2D" parent="Coins/Coin1"] +position = Vector2(-29, 8) +scale = Vector2(0.5, 0.5) +bus = &"CollectSounds" + +[node name="Coin2" type="Sprite2D" parent="Coins"] +visible = false +z_index = -5 +texture = ExtResource("9_4flhr") + +[node name="Sound2" type="AudioStreamPlayer2D" parent="Coins/Coin2"] +position = Vector2(-29, 8) +scale = Vector2(0.5, 0.5) +bus = &"CollectSounds" + +[node name="Coin3" type="Sprite2D" parent="Coins"] +visible = false +z_index = -5 +texture = ExtResource("9_4flhr") + +[node name="Sound3" type="AudioStreamPlayer2D" parent="Coins/Coin3"] +position = Vector2(-29, 8) +scale = Vector2(0.5, 0.5) +bus = &"CollectSounds" + +[node name="Coin4" type="Sprite2D" parent="Coins"] +visible = false +z_index = -5 +texture = ExtResource("9_4flhr") + +[node name="Sound4" type="AudioStreamPlayer2D" parent="Coins/Coin4"] +position = Vector2(-29, 8) +scale = Vector2(0.5, 0.5) +bus = &"CollectSounds" + +[node name="Coin5" type="Sprite2D" parent="Coins"] +visible = false +z_index = -5 +texture = ExtResource("9_4flhr") + +[node name="Sound5" type="AudioStreamPlayer2D" parent="Coins/Coin5"] +position = Vector2(-29, 8) +scale = Vector2(0.5, 0.5) +bus = &"CollectSounds" + +[node name="Animator" type="AnimationPlayer" parent="."] +unique_name_in_owner = true +libraries = { +"": SubResource("AnimationLibrary_vvq7g") +} + +[node name="Top" type="CollisionShape2D" parent="."] +position = Vector2(32, -63) +shape = SubResource("RectangleShape2D_7lwl1") + +[node name="Bottom" type="CollisionShape2D" parent="."] +position = Vector2(32, 1) +shape = SubResource("RectangleShape2D_l8xvy") + +[node name="Back" type="CollisionShape2D" parent="."] +position = Vector2(92.5, -31) +shape = SubResource("RectangleShape2D_cpwqc") + +[node name="ClickableArea" type="Area2D" parent="."] +collision_layer = 128 +collision_mask = 128 +monitorable = false + +[node name="Shape" type="CollisionShape2D" parent="ClickableArea"] +position = Vector2(32, -83) +shape = SubResource("RectangleShape2D_1bxxn") +debug_color = Color(0.584314, 0.380392, 1, 0.243137) + +[node name="BlockedTracker" parent="." instance=ExtResource("6_x01u8")] +unique_name_in_owner = true + +[node name="Shape" type="CollisionShape2D" parent="BlockedTracker"] +position = Vector2(26.5, -31) +shape = SubResource("RectangleShape2D_0ike4") +debug_color = Color(0.733333, 0.447059, 0.411765, 0.419608) + +[node name="SheepSpawner" parent="." instance=ExtResource("7_07yq6")] +unique_name_in_owner = true +position = Vector2(50, -26) +scene = ExtResource("8_kgtsi") + +[connection signal="coin_inserted" from="." to="SheepSpawner" method="spawn"] +[connection signal="animation_finished" from="Animator" to="." method="_on_animation_finished"] +[connection signal="input_event" from="ClickableArea" to="." method="_on_roof_input"] +[connection signal="spawned" from="SheepSpawner" to="." method="_on_sheep_spawned" flags=3] diff --git a/entities/barn_coin_drop.ogg b/entities/barn_coin_drop.ogg new file mode 100644 index 0000000..c1eaa74 --- /dev/null +++ b/entities/barn_coin_drop.ogg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c8b1ff37ab129e70ed74389f9236de0a0ec330c8098446256af55cd9de3ec306 +size 8162 diff --git a/entities/barn_coin_drop.ogg.import b/entities/barn_coin_drop.ogg.import new file mode 100644 index 0000000..11b3331 --- /dev/null +++ b/entities/barn_coin_drop.ogg.import @@ -0,0 +1,19 @@ +[remap] + +importer="oggvorbisstr" +type="AudioStreamOggVorbis" +uid="uid://dbj3ctst1tbuo" +path="res://.godot/imported/barn_coin_drop.ogg-e5d1e420062934bce7bd63a7fb3bff3f.oggvorbisstr" + +[deps] + +source_file="res://entities/barn_coin_drop.ogg" +dest_files=["res://.godot/imported/barn_coin_drop.ogg-e5d1e420062934bce7bd63a7fb3bff3f.oggvorbisstr"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/entities/barn_coin_enter.ogg b/entities/barn_coin_enter.ogg new file mode 100644 index 0000000..dd8cbcd --- /dev/null +++ b/entities/barn_coin_enter.ogg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f0047d41fb97fc682cc4fe99d6fe244b5aefd59e381881cb1c7b7e3a4e584493 +size 10297 diff --git a/entities/barn_coin_enter.ogg.import b/entities/barn_coin_enter.ogg.import new file mode 100644 index 0000000..8845012 --- /dev/null +++ b/entities/barn_coin_enter.ogg.import @@ -0,0 +1,19 @@ +[remap] + +importer="oggvorbisstr" +type="AudioStreamOggVorbis" +uid="uid://yxokdio25nm8" +path="res://.godot/imported/barn_coin_enter.ogg-1ea34471536d1a5128ad047d684e36dc.oggvorbisstr" + +[deps] + +source_file="res://entities/barn_coin_enter.ogg" +dest_files=["res://.godot/imported/barn_coin_enter.ogg-1ea34471536d1a5128ad047d684e36dc.oggvorbisstr"] + +[params] + +loop=false +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/entities/barn_roof_back.png b/entities/barn_roof_back.png new file mode 100644 index 0000000..3f15d63 --- /dev/null +++ b/entities/barn_roof_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2e97782abb882bb41743161fa90039c471b3425ed5ed14ff27aee1c8e48ec327 +size 319 diff --git a/entities/barn_roof_back.png.import b/entities/barn_roof_back.png.import new file mode 100644 index 0000000..e085e07 --- /dev/null +++ b/entities/barn_roof_back.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://ch44qud0c5alj" +path="res://.godot/imported/barn_roof_back.png-1d0bbdbc295788fbebb4d99b8b57e599.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://entities/barn_roof_back.png" +dest_files=["res://.godot/imported/barn_roof_back.png-1d0bbdbc295788fbebb4d99b8b57e599.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 diff --git a/entities/barn_roof_front.png b/entities/barn_roof_front.png new file mode 100644 index 0000000..e48f15d --- /dev/null +++ b/entities/barn_roof_front.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:66d912ab1306bca7dac45b47ecf92c73093e470ce3e8d96e360f820f06a415f4 +size 660 diff --git a/entities/barn_roof_front.png.import b/entities/barn_roof_front.png.import new file mode 100644 index 0000000..d124e1a --- /dev/null +++ b/entities/barn_roof_front.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bjg4c6uxwasiw" +path="res://.godot/imported/barn_roof_front.png-6bfaa976c6093e8a1495a25d59c53cb3.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://entities/barn_roof_front.png" +dest_files=["res://.godot/imported/barn_roof_front.png-6bfaa976c6093e8a1495a25d59c53cb3.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 diff --git a/entities/barn_wall_back.png b/entities/barn_wall_back.png new file mode 100644 index 0000000..6f023f5 --- /dev/null +++ b/entities/barn_wall_back.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3bab797868052136f35037737d80ab271bfc46b54be72b57bed11eaf57791159 +size 478 diff --git a/entities/barn_wall_back.png.import b/entities/barn_wall_back.png.import new file mode 100644 index 0000000..2f3d635 --- /dev/null +++ b/entities/barn_wall_back.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://p6vg6dgj4ypb" +path="res://.godot/imported/barn_wall_back.png-01092625d5133cfc830aa9782f6e193b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://entities/barn_wall_back.png" +dest_files=["res://.godot/imported/barn_wall_back.png-01092625d5133cfc830aa9782f6e193b.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 diff --git a/entities/barn_wall_front.png b/entities/barn_wall_front.png new file mode 100644 index 0000000..a7b5741 --- /dev/null +++ b/entities/barn_wall_front.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b892d989358d4e12349067af0a46dbdc52011fdaf6667b8fd6d044911a5d28a1 +size 1029 diff --git a/entities/barn_wall_front.png.import b/entities/barn_wall_front.png.import new file mode 100644 index 0000000..59f550e --- /dev/null +++ b/entities/barn_wall_front.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bihburr5m7inq" +path="res://.godot/imported/barn_wall_front.png-00503dbfd427184ab8ac20fd32ede19a.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://entities/barn_wall_front.png" +dest_files=["res://.godot/imported/barn_wall_front.png-00503dbfd427184ab8ac20fd32ede19a.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 diff --git a/entities/chupacabra.gd b/entities/chupacabra.gd index ca5de6e..944c077 100644 --- a/entities/chupacabra.gd +++ b/entities/chupacabra.gd @@ -10,6 +10,8 @@ class_name Chupacabra @onready var movement_wander_tp: TargetPicker = movement_wander.get_node("TrackerMeat/TargetPicker") @onready var animator: AnimationPlayer = %"Animator" @onready var eater: Eater = %"Eater" +@onready var tophatter: Eater = %"TopHatter" +@onready var monocler: Eater = %"Monocler" func _on_move(movement: Vector2) -> void: @@ -22,6 +24,8 @@ func _on_eater_eaten(edible:Edible) -> void: func _on_dragged(_cursor: Cursor) -> void: collision_layer = 16 collision_mask = 18 + tophatter.collision_mask = 16 + monocler.collision_mask = 16 z_index = Enums.ZIndex.EntityAir y_sort_enabled = false eater.collision_mask = 16 @@ -30,6 +34,8 @@ func _on_dragged(_cursor: Cursor) -> void: func _on_fallen() -> void: collision_layer = 8 collision_mask = 14 + tophatter.collision_mask = 8 + monocler.collision_mask = 8 z_index = Enums.ZIndex.EntityGround y_sort_enabled = true eater.collision_mask = 8 diff --git a/entities/cthulhu.gd b/entities/cthulhu.gd index af1bbbb..8d4be9c 100644 --- a/entities/cthulhu.gd +++ b/entities/cthulhu.gd @@ -4,6 +4,8 @@ class_name Cthulhu @onready var sprite: SpriteLeftRight = %"Sprite" @onready var animator: AnimationPlayer = %"Animator" +@onready var tophatter: Eater = %"TopHatter" +@onready var monocler: Eater = %"Monocler" func _ready(): # Setup index and layers @@ -16,6 +18,8 @@ func _on_move(movement: Vector2): func _on_dragged(_cursor: Cursor) -> void: collision_layer = 16 collision_mask = 18 + tophatter.collision_mask = 16 + monocler.collision_mask = 16 z_index = Enums.ZIndex.EntityAir y_sort_enabled = false animator.play(&"drag_start") @@ -23,6 +27,8 @@ func _on_dragged(_cursor: Cursor) -> void: func _on_fallen() -> void: collision_layer = 8 collision_mask = 14 + tophatter.collision_mask = 8 + monocler.collision_mask = 8 z_index = Enums.ZIndex.EntityGround y_sort_enabled = true animator.play(&"RESET") diff --git a/entities/imp.gd b/entities/imp.gd index d6ef562..8f54bf9 100644 --- a/entities/imp.gd +++ b/entities/imp.gd @@ -5,6 +5,8 @@ class_name Imp @onready var sprite: SpriteLeftRight = %"Sprite" @onready var eater: Eater = %"Eater" @onready var animator: AnimationPlayer = %"Animator" +@onready var tophatter: Eater = %"TopHatter" +@onready var monocler: Eater = %"Monocler" func _ready(): @@ -21,6 +23,8 @@ func _on_eater_eaten(edible: Edible) -> void: func _on_dragged(_cursor: Cursor) -> void: collision_layer = 16 collision_mask = 18 + tophatter.collision_mask = 16 + monocler.collision_mask = 16 z_index = Enums.ZIndex.EntityAir y_sort_enabled = false eater.collision_mask = 16 @@ -29,6 +33,8 @@ func _on_dragged(_cursor: Cursor) -> void: func _on_fallen() -> void: collision_layer = 8 collision_mask = 14 + tophatter.collision_mask = 8 + monocler.collision_mask = 8 z_index = Enums.ZIndex.EntityGround y_sort_enabled = true eater.collision_mask = 8 diff --git a/entities/sheep.gd b/entities/sheep.gd index c835a82..468a8d3 100644 --- a/entities/sheep.gd +++ b/entities/sheep.gd @@ -4,6 +4,8 @@ class_name Sheep @onready var sprite: SpriteLeftRight = %"Sprite" @onready var animator: AnimationPlayer = %"Animator" +@onready var tophatter: Eater = %"TopHatter" +@onready var monocler: Eater = %"Monocler" func _ready(): @@ -17,6 +19,8 @@ func _on_move(movement: Vector2) -> void: func _on_dragged(_cursor: Cursor) -> void: collision_layer = 16 collision_mask = 18 + tophatter.collision_mask = 16 + monocler.collision_mask = 16 z_index = Enums.ZIndex.EntityAir y_sort_enabled = false animator.play(&"drag_start") @@ -24,6 +28,8 @@ func _on_dragged(_cursor: Cursor) -> void: func _on_fallen() -> void: collision_layer = 8 collision_mask = 14 + tophatter.collision_mask = 8 + monocler.collision_mask = 8 z_index = Enums.ZIndex.EntityGround y_sort_enabled = true animator.play(&"RESET") diff --git a/entities/sheep.tscn b/entities/sheep.tscn index 9865833..695f1ba 100644 --- a/entities/sheep.tscn +++ b/entities/sheep.tscn @@ -382,6 +382,18 @@ bus = &"DragSounds" stream = ExtResource("17_8kst2") bus = &"FallSounds" +[node name="MovementBarn" parent="." instance=ExtResource("10_05kcd")] +speed = 66.0 +direction = Vector2(-1, 0) +enabled = false + +[node name="BarnPriority" parent="MovementBarn" instance=ExtResource("11_0jlmk")] +alternative_priority = 60 + +[node name="ExitedTimer" type="Timer" parent="MovementBarn"] +wait_time = 2.0 +one_shot = true + [connection signal="eaten" from="Sprite/TopHatter" to="." method="_on_eater_eaten"] [connection signal="eaten" from="Sprite/TopHatter" to="Sprite/TopHatter/Spawner" method="enable" unbinds=1] [connection signal="goal_reached" from="Sprite/TopHatter" to="Sprite/TopHatter/Sprite" method="show"] @@ -431,3 +443,7 @@ bus = &"FallSounds" [connection signal="move_enabled" from="MovementDrag" to="MovementWander" method="clear_direction"] [connection signal="dragged" from="MovementDrag/Draggable" to="MovementDrag" method="drag"] [connection signal="dropped" from="MovementDrag/Draggable" to="MovementDrag" method="drop"] +[connection signal="move" from="MovementBarn" to="." method="_on_move"] +[connection signal="move_disabled" from="MovementBarn" to="MovementBarn/ExitedTimer" method="stop"] +[connection signal="move_enabled" from="MovementBarn" to="MovementBarn/ExitedTimer" method="start"] +[connection signal="timeout" from="MovementBarn/ExitedTimer" to="MovementBarn/BarnPriority" method="priority_default"] diff --git a/entities/watcher.tscn b/entities/watcher.tscn index 1d78981..1de5512 100644 --- a/entities/watcher.tscn +++ b/entities/watcher.tscn @@ -71,6 +71,18 @@ tracks/2/keys = { "update": 1, "values": [ExtResource("3_k8fgk")] } +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("Sprite:position") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(0, 0)] +} [sub_resource type="Animation" id="Animation_5yt72"] resource_name = "drag_loop" @@ -169,6 +181,42 @@ tracks/0/keys = { "update": 0, "values": [Vector2(0, 0), Vector2(0, -6), Vector2(0, 6), Vector2(0, 0)] } +tracks/1/type = "value" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("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("2_32yw7")] +} +tracks/2/type = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("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("3_k8fgk")] +} +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("Sprite:scale") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 0, +"values": [Vector2(2, 2)] +} [sub_resource type="AnimationLibrary" id="AnimationLibrary_yam4u"] _data = { @@ -198,7 +246,6 @@ script = ExtResource("1_brahc") [node name="Sprite" parent="." instance=ExtResource("1_thu73")] unique_name_in_owner = true -position = Vector2(0, -3.044) scale = Vector2(2, 2) texture = ExtResource("2_32yw7") left_texture = ExtResource("2_32yw7") @@ -399,6 +446,7 @@ bus = &"KillSounds" [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="Animator" method="play" binds= [&"drag_start"]] [connection signal="dragged" from="MovementDrag/Draggable" to="MovementDrag" method="drag"] [connection signal="dropped" from="MovementDrag/Draggable" to="MovementDrag" method="drop"] [connection signal="eaten" from="Eater" to="." method="_on_eater_eaten"] diff --git a/scenes/game/main_game.tscn b/scenes/game/main_game.tscn index 2b65538..da02cdb 100644 --- a/scenes/game/main_game.tscn +++ b/scenes/game/main_game.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=26 format=3 uid="uid://cxj5aud02f40j"] +[gd_scene load_steps=27 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"] @@ -19,6 +19,7 @@ [ext_resource type="PackedScene" uid="uid://gl4umoff474y" path="res://entities/cthulhu.tscn" id="15_k41qf"] [ext_resource type="PackedScene" uid="uid://cgpwig0rd08vh" path="res://entities/summoning_circle_pentagram.tscn" id="16_nhsrb"] [ext_resource type="PackedScene" uid="uid://db246fkcf452d" path="res://entities/tree.tscn" id="18_r8twr"] +[ext_resource type="PackedScene" uid="uid://cn0p5s44h86px" path="res://entities/barn.tscn" id="20_tek4w"] [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_058kb"] texture = ExtResource("2_o7bg5") @@ -988,4 +989,7 @@ position = Vector2(341, 247) [node name="Tree5" parent="." instance=ExtResource("18_r8twr")] position = Vector2(379, 292) +[node name="Barn" parent="." instance=ExtResource("20_tek4w")] +position = Vector2(472, -245) + [connection signal="recipe_matched" from="SummoningCirclePentagram" to="." method="_on_recipe_matched"]