summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2025-11-21 13:56:01 +0200
committerJan Tuomi <jan@jantuomi.fi>2025-11-21 14:01:11 +0200
commit413d219eba1157284a6a90ecb9f736058158bb5f (patch)
tree50c7b2a6e1b4c9a1eb01b7f94e3f67703b3aae16
parent7b44fcc1ef95fdfcc6723f8e6a594012764a8cab (diff)
Add map
-rw-r--r--docs/index.html2
-rw-r--r--docs/index.pckbin2031252 -> 2035852 bytes
-rw-r--r--docs/index.service.worker.js2
-rw-r--r--door.gd4
-rw-r--r--esc_listener.gd4
-rw-r--r--map.gd19
-rw-r--r--map.gd.uid1
-rw-r--r--map.tscn43
-rw-r--r--map_room.gd2
-rw-r--r--map_room.gd.uid1
-rw-r--r--map_room.tscn6
-rw-r--r--room_main_menu.gd4
-rw-r--r--top.gd6
-rw-r--r--transition_manager.gd1
14 files changed, 85 insertions, 10 deletions
diff --git a/docs/index.html b/docs/index.html
index bc734da..33694e1 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -112,7 +112,7 @@ body {
<script src="index.js"></script>
<script>
-const GODOT_CONFIG = {"args":[],"canvasResizePolicy":2,"emscriptenPoolSize":8,"ensureCrossOriginIsolationHeaders":true,"executable":"index","experimentalVK":false,"fileSizes":{"index.pck":2031252,"index.wasm":38034280},"focusCanvas":true,"gdextensionLibs":[],"godotPoolSize":4,"serviceWorker":"index.service.worker.js"};
+const GODOT_CONFIG = {"args":[],"canvasResizePolicy":2,"emscriptenPoolSize":8,"ensureCrossOriginIsolationHeaders":true,"executable":"index","experimentalVK":false,"fileSizes":{"index.pck":2035852,"index.wasm":38034280},"focusCanvas":true,"gdextensionLibs":[],"godotPoolSize":4,"serviceWorker":"index.service.worker.js"};
const GODOT_THREADS_ENABLED = false;
const engine = new Engine(GODOT_CONFIG);
diff --git a/docs/index.pck b/docs/index.pck
index 4fa9031..728e502 100644
--- a/docs/index.pck
+++ b/docs/index.pck
Binary files differ
diff --git a/docs/index.service.worker.js b/docs/index.service.worker.js
index 887a823..e02bcd8 100644
--- a/docs/index.service.worker.js
+++ b/docs/index.service.worker.js
@@ -4,7 +4,7 @@
// Incrementing CACHE_VERSION will kick off the install event and force
// previously cached resources to be updated from the network.
/** @type {string} */
-const CACHE_VERSION = '1763711573|24285426062';
+const CACHE_VERSION = '1763726174|3525817723';
/** @type {string} */
const CACHE_PREFIX = 'MobileMetroidvan-sw-cache-';
const CACHE_NAME = CACHE_PREFIX + CACHE_VERSION;
diff --git a/door.gd b/door.gd
index ae05d39..101b052 100644
--- a/door.gd
+++ b/door.gd
@@ -2,7 +2,7 @@
class_name Door
extends Area2D
-@onready var transition_manager: TransitionManager = get_tree().root.get_node("Top/TransitionManager")
+@onready var top: Top = get_tree().root.get_node("Top")
var _target_room: Variant
var _target_door: Variant
@@ -30,7 +30,7 @@ func _get(property):
func _on_body_entered(_player: Player) -> void:
if not Engine.is_editor_hint():
- transition_manager.room_transition(self, _target_room, _target_door)
+ top.get_transition_manager().room_transition(self, _target_room, _target_door)
func _get_property_list() -> Array[Dictionary]:
var rooms: PackedStringArray = []
diff --git a/esc_listener.gd b/esc_listener.gd
index ecb68bd..e0267d8 100644
--- a/esc_listener.gd
+++ b/esc_listener.gd
@@ -1,7 +1,7 @@
extends Node
-@onready var transition_manager: TransitionManager = get_tree().root.get_node("Top/TransitionManager")
+@onready var top: Top = get_tree().root.get_node("Top")
func _process(_delta: float) -> void:
if Input.is_action_just_pressed("menu"):
- transition_manager.room_transition(null, "res://room_main_menu.tscn", null)
+ top.get_transition_manager().room_transition(null, "res://room_main_menu.tscn", null)
diff --git a/map.gd b/map.gd
new file mode 100644
index 0000000..478a5f3
--- /dev/null
+++ b/map.gd
@@ -0,0 +1,19 @@
+class_name Map
+extends CanvasLayer
+
+var active_map_room: MapRoom
+
+@export var inactive_color: Color
+@export var active_color: Color
+
+func set_active_name(map_room_name: String):
+ if active_map_room:
+ active_map_room.color = inactive_color
+
+ if has_node(map_room_name):
+ active_map_room = get_node(map_room_name)
+ else:
+ active_map_room = null
+
+ if active_map_room:
+ active_map_room.color = active_color
diff --git a/map.gd.uid b/map.gd.uid
new file mode 100644
index 0000000..25fe05c
--- /dev/null
+++ b/map.gd.uid
@@ -0,0 +1 @@
+uid://dh0b4xa4f8h1o
diff --git a/map.tscn b/map.tscn
index 775ee14..0d94613 100644
--- a/map.tscn
+++ b/map.tscn
@@ -1,3 +1,44 @@
-[gd_scene format=3 uid="uid://cseqghymhiyqo"]
+[gd_scene load_steps=3 format=3 uid="uid://cseqghymhiyqo"]
+
+[ext_resource type="Script" uid="uid://dh0b4xa4f8h1o" path="res://map.gd" id="1_wijl4"]
+[ext_resource type="PackedScene" uid="uid://clm2kocuhjqbb" path="res://map_room.tscn" id="2_e0an3"]
[node name="Map" type="CanvasLayer"]
+script = ExtResource("1_wijl4")
+inactive_color = Color(0.747755, 0.7671235, 0.89114594, 1)
+active_color = Color(0, 0.77254903, 0.7764706, 1)
+
+[node name="Bg" type="ColorRect" parent="."]
+offset_left = 3.0
+offset_top = 2.0
+offset_right = 29.0
+offset_bottom = 23.0
+color = Color(0, 0, 0, 0.5019608)
+
+[node name="RoomTest1" parent="." instance=ExtResource("2_e0an3")]
+offset_left = 7.0
+offset_top = 6.0
+offset_right = 15.0
+offset_bottom = 11.0
+
+[node name="Line2D" type="Line2D" parent="RoomTest1"]
+position = Vector2(7.275, 2.5)
+points = PackedVector2Array(0.7251587, 0.15686035, 2.7251587, 0.15686035)
+width = 1.0
+
+[node name="Line2D2" type="Line2D" parent="RoomTest1"]
+position = Vector2(3.2749996, 7.5)
+points = PackedVector2Array(0.7251587, 0.15686035, 0.7249985, -2.5)
+width = 1.0
+
+[node name="RoomTest3" parent="." instance=ExtResource("2_e0an3")]
+offset_left = 7.0
+offset_top = 13.0
+offset_right = 15.0
+offset_bottom = 18.0
+
+[node name="RoomTest2" parent="." instance=ExtResource("2_e0an3")]
+offset_left = 17.0
+offset_top = 6.0
+offset_right = 25.0
+offset_bottom = 11.0
diff --git a/map_room.gd b/map_room.gd
new file mode 100644
index 0000000..2b55a3f
--- /dev/null
+++ b/map_room.gd
@@ -0,0 +1,2 @@
+class_name MapRoom
+extends ColorRect
diff --git a/map_room.gd.uid b/map_room.gd.uid
new file mode 100644
index 0000000..520eeb6
--- /dev/null
+++ b/map_room.gd.uid
@@ -0,0 +1 @@
+uid://b1mxftq1jboum
diff --git a/map_room.tscn b/map_room.tscn
index 891e634..b7cd2bb 100644
--- a/map_room.tscn
+++ b/map_room.tscn
@@ -1,7 +1,11 @@
-[gd_scene format=3 uid="uid://clm2kocuhjqbb"]
+[gd_scene load_steps=2 format=3 uid="uid://clm2kocuhjqbb"]
+
+[ext_resource type="Script" uid="uid://b1mxftq1jboum" path="res://map_room.gd" id="1_oc81s"]
[node name="MapRoom" type="ColorRect"]
offset_left = 68.0
offset_top = 57.0
offset_right = 76.0
offset_bottom = 62.0
+color = Color(0.7490196, 0.76862746, 0.8901961, 1)
+script = ExtResource("1_oc81s")
diff --git a/room_main_menu.gd b/room_main_menu.gd
index 5c25f9c..4f58704 100644
--- a/room_main_menu.gd
+++ b/room_main_menu.gd
@@ -6,5 +6,5 @@ func _ready() -> void:
$TestRoomButton.pressed.connect(_test_room_button_pressed)
func _test_room_button_pressed():
- var transition_manager: TransitionManager = get_tree().root.get_node("Top/TransitionManager")
- transition_manager.room_transition(null, "res://room_test1.tscn", null)
+ var top: Top = get_tree().root.get_node("Top")
+ top.get_transition_manager().room_transition(null, "res://room_test1.tscn", null)
diff --git a/top.gd b/top.gd
index a4051b0..67f887f 100644
--- a/top.gd
+++ b/top.gd
@@ -30,3 +30,9 @@ func replace_active_room(new_room: Node, on_changed: Callable):
new_room.connect("tree_entered", on_changed)
new_room.process_mode = Node.PROCESS_MODE_PAUSABLE
add_child(new_room)
+
+func get_map() -> Map:
+ return $Map
+
+func get_transition_manager() -> TransitionManager:
+ return $TransitionManager
diff --git a/transition_manager.gd b/transition_manager.gd
index d9a4a09..ec8a618 100644
--- a/transition_manager.gd
+++ b/transition_manager.gd
@@ -31,6 +31,7 @@ func _transition_start():
while _transition_room == null:
await get_tree().create_timer(0.1).timeout
+ top.get_map().set_active_name(_transition_room.name)
top.replace_active_room(_transition_room, _on_room_changed)
func _on_room_changed():