Puzzle and room managers and some grave jingles

master
Wynd 2024-09-15 17:51:07 +03:00
parent 649061fe6a
commit 0df47e378d
33 changed files with 370 additions and 78 deletions

View File

@ -0,0 +1,6 @@
[gd_scene format=3 uid="uid://dpn82ibpmpb6u"]
[node name="Player" type="Node2D"]
position = Vector2(240, 72)
[node name="Camera2D" type="Camera2D" parent="."]

View File

Before

Width:  |  Height:  |  Size: 166 B

After

Width:  |  Height:  |  Size: 166 B

View File

@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://b4i416bsd62n1"
path="res://.godot/imported/box-switch.png-b01d7f98c3af35149b3dac0b2da9ed80.ctex"
path="res://.godot/imported/box-switch.png-df9369c771924cc3ffd7d773f48b5997.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://objects/assets/box-switch.png"
dest_files=["res://.godot/imported/box-switch.png-b01d7f98c3af35149b3dac0b2da9ed80.ctex"]
source_file="res://puzzles/assets/box-switch.png"
dest_files=["res://.godot/imported/box-switch.png-df9369c771924cc3ffd7d773f48b5997.ctex"]
[params]

View File

Before

Width:  |  Height:  |  Size: 206 B

After

Width:  |  Height:  |  Size: 206 B

View File

@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://br4mm65ok0dfl"
path="res://.godot/imported/box.png-87b425849f24b1a9b2fd08bc5358c175.ctex"
path="res://.godot/imported/box.png-577fbae96f6532bc895a10d7db685d0f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://objects/assets/box.png"
dest_files=["res://.godot/imported/box.png-87b425849f24b1a9b2fd08bc5358c175.ctex"]
source_file="res://puzzles/assets/box.png"
dest_files=["res://.godot/imported/box.png-577fbae96f6532bc895a10d7db685d0f.ctex"]
[params]

View File

Before

Width:  |  Height:  |  Size: 252 B

After

Width:  |  Height:  |  Size: 252 B

View File

@ -3,15 +3,15 @@
importer="texture"
type="CompressedTexture2D"
uid="uid://boii66my2eiqr"
path="res://.godot/imported/grave.png-f7e08caf0094f9eb8b4fb58fe0a09e30.ctex"
path="res://.godot/imported/grave.png-767f7b22830c1a952cf645ad4ec4bc33.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://objects/assets/grave.png"
dest_files=["res://.godot/imported/grave.png-f7e08caf0094f9eb8b4fb58fe0a09e30.ctex"]
source_file="res://puzzles/assets/grave.png"
dest_files=["res://.godot/imported/grave.png-767f7b22830c1a952cf645ad4ec4bc33.ctex"]
[params]

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=5 format=3 uid="uid://cjus07bbbn4wd"]
[ext_resource type="Texture2D" uid="uid://br4mm65ok0dfl" path="res://objects/assets/box.png" id="1_myqej"]
[ext_resource type="Texture2D" uid="uid://br4mm65ok0dfl" path="res://puzzles/assets/box.png" id="1_myqej"]
[sub_resource type="Animation" id="Animation_21bg4"]
resource_name = "RESET"

View File

@ -1,6 +1,6 @@
[gd_scene load_steps=6 format=3 uid="uid://c2qq84wh76mkx"]
[ext_resource type="Texture2D" uid="uid://b4i416bsd62n1" path="res://objects/assets/box-switch.png" id="1_s5gx1"]
[ext_resource type="Texture2D" uid="uid://b4i416bsd62n1" path="res://puzzles/assets/box-switch.png" id="1_s5gx1"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_g4f6l"]
size = Vector2(8, 8)

View File

@ -0,0 +1,52 @@
class_name Grave
extends Node2D
@export var pair: Grave
@export var jingle: AudioStream
@onready var animation_player: AnimationPlayer = $AnimationPlayer
@onready var audio_player: AudioStreamPlayer2D = $AudioStreamPlayer2D
@export var test = false
var is_singing = false
var is_finished = false
@export var last_used_tick = 60
func _ready():
pass # Replace with function body.
func _process(delta):
if last_used_tick > 0:
last_used_tick -= 1
if test and last_used_tick <= 0:
complete()
pair.complete()
pass
func _physics_process(delta):
pass
func sing():
if is_finished:
return
animation_player.play(&"sing")
if !audio_player.is_playing():
audio_player.stream = jingle
audio_player.play()
func complete():
if is_finished:
return
animation_player.play(&"complete")
if !audio_player.is_playing():
audio_player.stream = jingle
audio_player.play()
is_finished = true
func _on_animation_player_animation_finished(anim_name):
if anim_name == &"sing":
animation_player.play(&"RESET")
is_singing = false

View File

@ -1,6 +1,7 @@
[gd_scene load_steps=7 format=3 uid="uid://chmxabjea27ay"]
[gd_scene load_steps=8 format=3 uid="uid://chmxabjea27ay"]
[ext_resource type="Texture2D" uid="uid://boii66my2eiqr" path="res://objects/assets/grave.png" id="1_wcgrd"]
[ext_resource type="Script" path="res://puzzles/grave/grave.gd" id="1_ooabc"]
[ext_resource type="Texture2D" uid="uid://boii66my2eiqr" path="res://puzzles/assets/grave.png" id="1_wcgrd"]
[sub_resource type="Animation" id="Animation_4eb2t"]
resource_name = "RESET"
@ -34,7 +35,7 @@ tracks/0/keys = {
[sub_resource type="Animation" id="Animation_w5bs5"]
resource_name = "sing"
loop_mode = 1
length = 2.0
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
@ -42,10 +43,10 @@ tracks/0/path = NodePath(".:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.25, 0.5, 0.75),
"transitions": PackedFloat32Array(1, 1, 1, 1),
"times": PackedFloat32Array(0, 0.25, 0.5, 0.75, 1, 1.25, 1.5, 1.75),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [1, 2, 3, 4]
"values": [1, 2, 3, 4, 1, 2, 3, 4]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_n47hy"]
@ -59,6 +60,7 @@ _data = {
atlas = ExtResource("1_wcgrd")
[node name="Grave" type="Node2D"]
script = ExtResource("1_ooabc")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
root_node = NodePath("../Sprite2D")
@ -72,3 +74,7 @@ texture_filter = 1
texture = SubResource("AtlasTexture_h3pxl")
hframes = 5
vframes = 2
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
[connection signal="animation_finished" from="AnimationPlayer" to="." method="_on_animation_player_animation_finished"]

View File

@ -0,0 +1,15 @@
class_name GravePuzzle
extends Puzzle
@export var graves: Array[Grave] = []
func _process(delta):
var is_finished = true
for grave in graves:
if !grave.is_finished:
is_finished = false
break;
if is_finished:
complete()

14
puzzles/puzzle.gd 100644
View File

@ -0,0 +1,14 @@
class_name Puzzle
extends Node
signal complete_puzzle(puzzle_name: String)
var is_complete = false;
func complete():
if is_complete:
return
is_complete = true
complete_puzzle.emit()

View File

@ -0,0 +1,15 @@
extends PuzzleManager
#@onready var demo_puzzle = $DemoGravePuzzle1
@onready var next_room_fog = $NextRoomFog
func _process(delta):
if is_room_finished():
if next_room_fog != null:
next_room_fog.queue_free()
pass
func _on_demo_grave_puzzle_complete():
print("Demo Puzzle 1 Solved")
pass

View File

@ -0,0 +1,16 @@
class_name PuzzleManager
extends Node
signal finish_room
@export var mandatory_puzzles: Array[Puzzle]
@export var optional_puzzles: Array[Puzzle]
func _process(delta):
pass
func is_room_finished():
for puzzle in mandatory_puzzles:
if !puzzle.is_complete:
return false
return true

View File

@ -0,0 +1,6 @@
[gd_scene load_steps=2 format=3 uid="uid://dmacmq1lcdfqa"]
[ext_resource type="Script" path="res://puzzles/room_manager/room_manager.gd" id="1_cp3nr"]
[node name="RoomManager" type="Node2D"]
script = ExtResource("1_cp3nr")

View File

@ -0,0 +1 @@
3,0,0,0,120,16,4,2,0,0,0,128,0,256,221,0,5,128,0,256,3,0,0,0,0,4,63,1,0,0,64,1,3,0,65,1,1,0,68,1,2,0,0,0,0,0,0,0,0,0,0,1,0,4,41,1,0,0,43,1,3,0,44,1,1,0,46,1,2,0,0,1,0,1,2,-1,-1,-1,-1,-1,-1,-1,

Binary file not shown.

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://dptmnectas0m2"
path="res://.godot/imported/grave_jingle1.wav-587e3a1c02000cf5651340bdf405eb4f.sample"
[deps]
source_file="res://scenes/assets/jingles/grave_jingle1.wav"
dest_files=["res://.godot/imported/grave_jingle1.wav-587e3a1c02000cf5651340bdf405eb4f.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View File

@ -0,0 +1 @@
3,0,0,0,120,16,4,2,0,0,0,128,0,256,221,0,5,128,0,256,3,0,0,0,0,4,63,1,0,0,64,1,3,0,65,1,1,0,68,1,2,0,0,0,0,0,0,0,0,0,0,1,0,4,39,1,1,0,43,1,2,0,45,1,3,0,46,1,0,0,0,1,0,1,2,-1,-1,-1,-1,-1,-1,-1,

Binary file not shown.

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://dnxrsod40dh80"
path="res://.godot/imported/grave_jingle2.wav-6834970cc6a63e0c614cb8bbed8c035c.sample"
[deps]
source_file="res://scenes/assets/jingles/grave_jingle2.wav"
dest_files=["res://.godot/imported/grave_jingle2.wav-6834970cc6a63e0c614cb8bbed8c035c.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View File

@ -0,0 +1 @@
3,0,0,0,120,16,4,2,0,0,0,128,0,256,221,0,5,128,0,256,3,0,0,0,0,4,63,1,0,0,64,1,3,0,65,1,1,0,68,1,2,0,0,0,0,0,0,0,0,0,0,1,0,4,39,1,0,0,39,1,2,0,40,1,1,0,40,1,3,0,0,1,0,1,2,-1,-1,-1,-1,-1,-1,-1,

Binary file not shown.

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://cmvhh5ytxntks"
path="res://.godot/imported/grave_jingle3.wav-1ecc8a24b8ca4a7207783e36af1555e4.sample"
[deps]
source_file="res://scenes/assets/jingles/grave_jingle3.wav"
dest_files=["res://.godot/imported/grave_jingle3.wav-1ecc8a24b8ca4a7207783e36af1555e4.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View File

@ -0,0 +1 @@
3,0,0,0,120,16,4,2,0,0,0,128,0,256,221,0,5,128,0,256,3,0,0,0,0,4,63,1,0,0,64,1,3,0,65,1,1,0,68,1,2,0,0,0,0,0,0,0,0,0,0,1,0,4,38,1,5,0,39,1,7,0,45,1,2,0,47,1,0,0,0,1,0,1,2,-1,-1,-1,-1,-1,-1,-1,

Binary file not shown.

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://b6gukjjv4o82b"
path="res://.godot/imported/grave_jingle4.wav-1f87862811376dfa764a5717c9e6de28.sample"
[deps]
source_file="res://scenes/assets/jingles/grave_jingle4.wav"
dest_files=["res://.godot/imported/grave_jingle4.wav-1f87862811376dfa764a5717c9e6de28.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View File

@ -0,0 +1 @@
3,0,0,0,120,16,4,2,0,0,0,128,0,256,221,0,5,128,0,256,3,0,0,0,0,4,63,1,0,0,64,1,3,0,65,1,1,0,68,1,2,0,0,0,0,0,0,0,0,0,0,1,0,4,36,1,7,0,38,1,0,0,39,1,2,0,45,1,5,0,0,1,0,1,2,-1,-1,-1,-1,-1,-1,-1,

Binary file not shown.

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://bogaat12g1qmw"
path="res://.godot/imported/grave_jingle5.wav-ad92ed60935fe056ea04c07844109daf.sample"
[deps]
source_file="res://scenes/assets/jingles/grave_jingle5.wav"
dest_files=["res://.godot/imported/grave_jingle5.wav-ad92ed60935fe056ea04c07844109daf.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=0

View File

@ -0,0 +1,36 @@
[gd_resource type="TileSet" load_steps=3 format=3 uid="uid://beqyyhtlgk8tg"]
[ext_resource type="Texture2D" uid="uid://cbuibrshdpkm1" path="res://scenes/assets/tileset.png" id="1_al8fb"]
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_m1u1u"]
texture = ExtResource("1_al8fb")
texture_region_size = Vector2i(8, 8)
0:0/0 = 0
1:0/0 = 0
4:0/0 = 0
5:0/0 = 0
6:0/0 = 0
4:1/0 = 0
5:1/0 = 0
6:1/0 = 0
7:1/0 = 0
7:0/0 = 0
1:1/0 = 0
0:1/animation_columns = 1
0:1/animation_speed = 2.0
0:1/animation_frame_0/duration = 1.0
0:1/animation_frame_1/duration = 1.0
0:1/0 = 0
2:0/animation_mode = 1
2:0/0 = 0
2:0/0/probability = 0.5
3:0/animation_columns = 1
3:0/animation_mode = 1
3:0/animation_frame_0/duration = 1.0
3:0/animation_frame_1/duration = 1.0
3:0/0 = 0
3:0/0/probability = 0.2
[resource]
tile_size = Vector2i(8, 8)
sources/0 = SubResource("TileSetAtlasSource_m1u1u")

File diff suppressed because one or more lines are too long