summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2026-01-28 18:22:34 +0200
committerJan Tuomi <jan@jantuomi.fi>2026-01-28 18:22:34 +0200
commit81c5a2c75112699297d31d5736a0770b84b2d525 (patch)
tree746c41597362d9fb83fa16c739bc414c89d0011e
parent7e2875109d458e2183ad0c27f833b432981a54c2 (diff)
Add cinematic bars
-rw-r--r--cinematic_bar_player.tscn81
-rw-r--r--dialogues/relic_get.gd19
-rw-r--r--dialogues/relic_get.gd.uid1
-rw-r--r--inventory.gd5
-rw-r--r--player.gd2
-rw-r--r--relic.gd36
-rw-r--r--relic.gd.uid1
-rw-r--r--rooms/relic.tscn23
-rw-r--r--rooms/surface19.tscn24
-rw-r--r--rooms/test3.tscn1
-rw-r--r--top.gd24
-rw-r--r--top.tscn5
12 files changed, 200 insertions, 22 deletions
diff --git a/cinematic_bar_player.tscn b/cinematic_bar_player.tscn
new file mode 100644
index 0000000..a3e7b7a
--- /dev/null
+++ b/cinematic_bar_player.tscn
@@ -0,0 +1,81 @@
+[gd_scene load_steps=4 format=3 uid="uid://cq4bp0ntede7c"]
+
+[sub_resource type="Animation" id="Animation_vqfly"]
+length = 0.001
+tracks/0/type = "value"
+tracks/0/imported = false
+tracks/0/enabled = true
+tracks/0/path = NodePath("BottomBar:size")
+tracks/0/interp = 1
+tracks/0/loop_wrap = true
+tracks/0/keys = {
+"times": PackedFloat32Array(0),
+"transitions": PackedFloat32Array(1),
+"update": 0,
+"values": [Vector2(0, 14)]
+}
+tracks/1/type = "value"
+tracks/1/imported = false
+tracks/1/enabled = true
+tracks/1/path = NodePath("TopBar:size")
+tracks/1/interp = 1
+tracks/1/loop_wrap = true
+tracks/1/keys = {
+"times": PackedFloat32Array(0),
+"transitions": PackedFloat32Array(1),
+"update": 0,
+"values": [Vector2(0, 14)]
+}
+
+[sub_resource type="Animation" id="Animation_hh2nh"]
+resource_name = "cine_bars"
+tracks/0/type = "value"
+tracks/0/imported = false
+tracks/0/enabled = true
+tracks/0/path = NodePath("BottomBar:size")
+tracks/0/interp = 1
+tracks/0/loop_wrap = true
+tracks/0/keys = {
+"times": PackedFloat32Array(0, 1),
+"transitions": PackedFloat32Array(1, 1),
+"update": 0,
+"values": [Vector2(0, 10), Vector2(192, 10)]
+}
+tracks/1/type = "value"
+tracks/1/imported = false
+tracks/1/enabled = true
+tracks/1/path = NodePath("TopBar:size")
+tracks/1/interp = 1
+tracks/1/loop_wrap = true
+tracks/1/keys = {
+"times": PackedFloat32Array(0, 1),
+"transitions": PackedFloat32Array(1, 1),
+"update": 0,
+"values": [Vector2(0, 10), Vector2(192, 10)]
+}
+
+[sub_resource type="AnimationLibrary" id="AnimationLibrary_o6xfm"]
+_data = {
+&"RESET": SubResource("Animation_vqfly"),
+&"cine_bars": SubResource("Animation_hh2nh")
+}
+
+[node name="CanvasLayer" type="CanvasLayer"]
+
+[node name="TopBar" type="ColorRect" parent="."]
+offset_bottom = 14.0
+color = Color(0, 0, 0, 1)
+
+[node name="BottomBar" type="ColorRect" parent="."]
+offset_left = 192.0
+offset_top = 108.0
+offset_right = 192.0
+offset_bottom = 122.0
+rotation = 3.1415927
+color = Color(0, 0, 0, 1)
+
+[node name="Player" type="AnimationPlayer" parent="."]
+process_mode = 3
+libraries = {
+&"": SubResource("AnimationLibrary_o6xfm")
+}
diff --git a/dialogues/relic_get.gd b/dialogues/relic_get.gd
new file mode 100644
index 0000000..963eb79
--- /dev/null
+++ b/dialogues/relic_get.gd
@@ -0,0 +1,19 @@
+class_name DialogueRelicGet
+extends Dialogue
+
+@onready var top: Top = get_tree().root.get_node("Top")
+@onready var player: Player = parent.get_node("Player")
+var r: Node2D
+
+func _init(relic: Node2D):
+ r = relic
+
+func _ready():
+ get_tree().paused = true
+
+ await top.play_cine_bars()
+ await say(r, "You found a mysterious relic!")
+ top.clear_cine_bars()
+
+ r.queue_free()
+ get_tree().paused = false
diff --git a/dialogues/relic_get.gd.uid b/dialogues/relic_get.gd.uid
new file mode 100644
index 0000000..c5ed07a
--- /dev/null
+++ b/dialogues/relic_get.gd.uid
@@ -0,0 +1 @@
+uid://j0vbra41omei
diff --git a/inventory.gd b/inventory.gd
index 2da0fe0..f48ef9d 100644
--- a/inventory.gd
+++ b/inventory.gd
@@ -3,3 +3,8 @@ extends RefCounted
var zoop: bool
var hanging: bool
+var relics: Array[int]
+
+func add_relic(relic: int):
+ if not relic in relics:
+ relics.push_back(relic)
diff --git a/player.gd b/player.gd
index d91b0dc..085d8e8 100644
--- a/player.gd
+++ b/player.gd
@@ -18,7 +18,7 @@ var state: PlayerState = PlayerStateInit.new(self)
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
func _debug_info():
- return "%s\ngot zoop: %s\ngot hanging: %s" % [state.to_string(), str(inventory.zoop), str(inventory.hanging)]
+ return "%s\ngot zoop: %s\ngot hanging: %s\nrelics: %s" % [state.to_string(), str(inventory.zoop), str(inventory.hanging), str(inventory.relics)]
func _camera_target() -> Vector2:
var oy: float = 0
diff --git a/relic.gd b/relic.gd
new file mode 100644
index 0000000..6af3405
--- /dev/null
+++ b/relic.gd
@@ -0,0 +1,36 @@
+extends Sprite2D
+
+@onready var top: Top = get_tree().root.get_node("Top")
+@onready var ordinal = int(name.replace("Relic", ""))
+
+var t: float = 0
+const w: float = 5
+const A: float = 1
+
+var oscing = true
+var already_got = false
+
+func _ready():
+ for existing in top.inventory.relics:
+ if existing == ordinal:
+ turn_transparent()
+ already_got = true
+ break
+
+func turn_transparent():
+ modulate.a = 0.3
+
+func _physics_process(delta: float) -> void:
+ if oscing: t += delta
+ offset.y = A * sin(w * t)
+
+func _on_area_2d_body_entered(player: Player) -> void:
+ top.inventory.add_relic(ordinal)
+ top.game_save()
+
+ if already_got:
+ queue_free()
+ else:
+ var dia = DialogueRelicGet.new(self)
+ dia.process_mode = Node.PROCESS_MODE_ALWAYS
+ get_parent().add_child(dia)
diff --git a/relic.gd.uid b/relic.gd.uid
new file mode 100644
index 0000000..1f579e9
--- /dev/null
+++ b/relic.gd.uid
@@ -0,0 +1 @@
+uid://bhkotkakm8i4i
diff --git a/rooms/relic.tscn b/rooms/relic.tscn
new file mode 100644
index 0000000..ce50a99
--- /dev/null
+++ b/rooms/relic.tscn
@@ -0,0 +1,23 @@
+[gd_scene load_steps=4 format=3 uid="uid://cc6au2x7x3c5i"]
+
+[ext_resource type="Texture2D" uid="uid://chj76nr0mlfdi" path="res://assets.untracked/kenney_1-bit-platformer-pack/Tiles/Transparent/tile_0022.png" id="1_v8p2h"]
+[ext_resource type="Script" uid="uid://bhkotkakm8i4i" path="res://relic.gd" id="2_2utpd"]
+
+[sub_resource type="RectangleShape2D" id="RectangleShape2D_v8p2h"]
+size = Vector2(8.535536, 8.535535)
+
+[node name="Relic" type="Sprite2D"]
+texture = ExtResource("1_v8p2h")
+script = ExtResource("2_2utpd")
+
+[node name="Area2D" type="Area2D" parent="."]
+collision_layer = 64
+collision_mask = 2
+
+[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
+position = Vector2(-2.4689058e-08, -1.1920929e-07)
+rotation = 0.7853982
+scale = Vector2(0.9999999, 0.9999999)
+shape = SubResource("RectangleShape2D_v8p2h")
+
+[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"]
diff --git a/rooms/surface19.tscn b/rooms/surface19.tscn
index 3165e93..40e14e2 100644
--- a/rooms/surface19.tscn
+++ b/rooms/surface19.tscn
@@ -1,4 +1,4 @@
-[gd_scene load_steps=10 format=4 uid="uid://dr3ju5oehcjhx"]
+[gd_scene load_steps=9 format=4 uid="uid://dr3ju5oehcjhx"]
[ext_resource type="Script" uid="uid://cbhily4o7e2r3" path="res://room.gd" id="1_vlhxe"]
[ext_resource type="Texture2D" uid="uid://dkek11j5dh6as" path="res://assets.untracked/kenney_1-bit-platformer-pack/Tiles/Default/tile_0338.png" id="2_ywagw"]
@@ -7,21 +7,7 @@
[ext_resource type="PackedScene" uid="uid://coxnsharboouu" path="res://player.tscn" id="5_d5y4x"]
[ext_resource type="PackedScene" uid="uid://df0loiahar23o" path="res://door.tscn" id="6_i631u"]
[ext_resource type="Texture2D" uid="uid://tmcwkm2n5nrq" path="res://assets/kenney_1-bit-platformer-pack/Tiles/Transparent/tile_0165.png" id="7_vlhxe"]
-[ext_resource type="Texture2D" uid="uid://chj76nr0mlfdi" path="res://assets/kenney_1-bit-platformer-pack/Tiles/Transparent/tile_0022.png" id="8_ywagw"]
-
-[sub_resource type="GDScript" id="GDScript_lhrvv"]
-script/source = "extends Sprite2D
-
-var t: float = 0
-const w: float = 5
-const A: float = 1
-
-var oscing = true
-
-func _physics_process(delta: float) -> void:
- if oscing: t += delta
- offset.y = A * sin(w * t)
-"
+[ext_resource type="PackedScene" uid="uid://cc6au2x7x3c5i" path="res://rooms/relic.tscn" id="8_ywagw"]
[node name="Surface19" type="Node2D" groups=["debug_info"]]
process_mode = 1
@@ -57,7 +43,7 @@ position = Vector2(42, 54)
scale = Vector2(1, 4)
exit_towards = "RIGHT"
enter_towards = "LEFT"
-target_room = "res://rooms/surface2.tscn"
+target_room = "res://rooms/surface18.tscn"
target_door = "DoorRight"
[node name="DoorRight" parent="." instance=ExtResource("6_i631u")]
@@ -72,7 +58,5 @@ target_door = "DoorCave"
position = Vector2(288, 72)
texture = ExtResource("7_vlhxe")
-[node name="Relic" type="Sprite2D" parent="."]
+[node name="Relic1" parent="." instance=ExtResource("8_ywagw")]
position = Vector2(168, 56)
-texture = ExtResource("8_ywagw")
-script = SubResource("GDScript_lhrvv")
diff --git a/rooms/test3.tscn b/rooms/test3.tscn
index 628719f..d8857d4 100644
--- a/rooms/test3.tscn
+++ b/rooms/test3.tscn
@@ -100,6 +100,7 @@ scale = Vector2(4, 1)
exit_towards = "DROP"
enter_towards = "JUMP"
target_room = "res://rooms/test1.tscn"
+target_door = "DoorLeft"
[node name="ComputerPath" type="Path2D" parent="."]
curve = SubResource("Curve2D_bml3v")
diff --git a/top.gd b/top.gd
index 85bf86e..bd664f5 100644
--- a/top.gd
+++ b/top.gd
@@ -57,6 +57,13 @@ func toggle_pause():
else:
add_child.call_deferred(pause_menu)
+func play_cine_bars():
+ $CinematicBars/Player.play("cine_bars")
+ await $CinematicBars/Player.animation_finished
+
+func clear_cine_bars():
+ $CinematicBars/Player.play("RESET")
+
# Save state logic
@onready var save_state: ConfigFile = ConfigFile.new()
@@ -66,11 +73,21 @@ const SAVE_ACTIVE_ROOM_PATH = "ACTIVE_ROOM_PATH"
const SAVE_LAST_DOOR_NAME = "LAST_DOOR_NAME"
const SAVE_GOT_ZOOP = "GOT_ZOOP"
const SAVE_GOT_HANG = "GOT_HANG"
+const SAVE_RELICS = "RELICS"
func game_set(k: String, v: Variant):
save_state.set_value(SAVE_SECTION, k, v)
func game_save():
+ save_state.set_value(SAVE_SECTION, SAVE_GOT_HANG, inventory.hanging)
+ save_state.set_value(SAVE_SECTION, SAVE_GOT_ZOOP, inventory.zoop)
+
+ var relics_str: PackedStringArray = []
+ for relic in inventory.relics:
+ relics_str.push_back(str(relic))
+ var relics_csv = ",".join(relics_str)
+ save_state.set_value(SAVE_SECTION, SAVE_RELICS, relics_csv)
+
save_state.save(SAVE_PATH)
func game_load():
@@ -82,4 +99,11 @@ func game_load():
inventory.hanging = save_state.get_value(SAVE_SECTION, SAVE_GOT_HANG, false)
inventory.zoop = save_state.get_value(SAVE_SECTION, SAVE_GOT_ZOOP, false)
+ inventory.relics = []
+ # COMMENTED OUT FOR DEV so that reloads/deaths reset relics
+ #var relics_csv: String = save_state.get_value(SAVE_SECTION, SAVE_RELICS, "")
+ #for relic in relics_csv.split(",", false):
+ # var relic_int = int(relic)
+ # inventory.relics.push_back(relic_int)
+
$TransitionPlayer.room_transition(null, save_active_room_path, save_last_door_name)
diff --git a/top.tscn b/top.tscn
index bf98de9..0df41e1 100644
--- a/top.tscn
+++ b/top.tscn
@@ -1,7 +1,8 @@
-[gd_scene load_steps=18 format=3 uid="uid://cey3jxnpmommt"]
+[gd_scene load_steps=19 format=3 uid="uid://cey3jxnpmommt"]
[ext_resource type="Material" uid="uid://bb4b8jm2tyy81" path="res://mat_palette.tres" id="1_edsjh"]
[ext_resource type="Script" uid="uid://dxbspy72bg0db" path="res://top.gd" id="1_on2c2"]
+[ext_resource type="PackedScene" uid="uid://cq4bp0ntede7c" path="res://cinematic_bar_player.tscn" id="3_fj57p"]
[ext_resource type="Script" uid="uid://cph2apstgper1" path="res://palette_shader.gd" id="5_ch5ua"]
[ext_resource type="PackedScene" uid="uid://cciwccvljuuyq" path="res://touch_screen_ui.tscn" id="5_edsjh"]
[ext_resource type="PackedScene" uid="uid://cseqghymhiyqo" path="res://pause_menu_map.tscn" id="5_tk1sh"]
@@ -153,6 +154,8 @@ process_mode = 3
material = ExtResource("1_edsjh")
script = ExtResource("1_on2c2")
+[node name="CinematicBars" parent="." instance=ExtResource("3_fj57p")]
+
[node name="TransitionPlayer" type="AnimationPlayer" parent="."]
libraries = {
&"": SubResource("AnimationLibrary_2exal")