summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2025-11-21 17:07:57 +0200
committerJan Tuomi <jan@jantuomi.fi>2025-11-21 17:08:13 +0200
commit242dec6cb636be957fe1c13415762f1e204deef7 (patch)
treeb0a3c7e1281932abe73f40041082cacd10e28cd4
parent015e7c2d4f237c7a4f6dec21680f1726ca2fa9dc (diff)
Refactor map
-rw-r--r--docs/index.html2
-rw-r--r--docs/index.pckbin2035852 -> 2036644 bytes
-rw-r--r--docs/index.service.worker.js2
-rw-r--r--map.gd14
-rw-r--r--map.tscn2
-rw-r--r--map_room.gd14
-rw-r--r--map_room.tscn14
-rw-r--r--room_test3.tscn2
8 files changed, 32 insertions, 18 deletions
diff --git a/docs/index.html b/docs/index.html
index 33694e1..5d39e8b 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":2035852,"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":2036644,"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 728e502..e7bf4ba 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 e02bcd8..b82f376 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 = '1763726174|3525817723';
+const CACHE_VERSION = '1763737689|4451920408';
/** @type {string} */
const CACHE_PREFIX = 'MobileMetroidvan-sw-cache-';
const CACHE_NAME = CACHE_PREFIX + CACHE_VERSION;
diff --git a/map.gd b/map.gd
index 42a5c29..4f39972 100644
--- a/map.gd
+++ b/map.gd
@@ -4,23 +4,15 @@ extends CanvasLayer
@onready var top: Top = get_tree().root.get_node("Top")
var active_map_room: MapRoom
-@export var inactive_color: Color
-@export var active_color: Color
-
func _ready():
hide_map()
func set_active_name(map_room_name: String):
- if active_map_room:
- active_map_room.color = inactive_color
+ if active_map_room: active_map_room.unhighlight()
- if has_node(map_room_name):
- active_map_room = get_node(map_room_name)
- else:
- active_map_room = null
+ active_map_room = get_node_or_null(map_room_name)
- if active_map_room:
- active_map_room.color = active_color
+ if active_map_room: active_map_room.highlight()
func show_map():
visible = true
diff --git a/map.tscn b/map.tscn
index 2e98503..8cb0cc8 100644
--- a/map.tscn
+++ b/map.tscn
@@ -7,8 +7,6 @@
[node name="Map" type="CanvasLayer"]
process_mode = 3
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_right = 192.0
diff --git a/map_room.gd b/map_room.gd
index 2b55a3f..ef81891 100644
--- a/map_room.gd
+++ b/map_room.gd
@@ -1,2 +1,16 @@
class_name MapRoom
extends ColorRect
+
+@export var inactive_color: Color
+@export var active_color: Color
+
+func _ready():
+ unhighlight()
+
+func highlight():
+ color = active_color
+ $PlayerIcon.visible = true
+
+func unhighlight():
+ color = inactive_color
+ $PlayerIcon.visible = false
diff --git a/map_room.tscn b/map_room.tscn
index b7cd2bb..74e41f5 100644
--- a/map_room.tscn
+++ b/map_room.tscn
@@ -1,11 +1,21 @@
-[gd_scene load_steps=2 format=3 uid="uid://clm2kocuhjqbb"]
+[gd_scene load_steps=3 format=3 uid="uid://clm2kocuhjqbb"]
[ext_resource type="Script" uid="uid://b1mxftq1jboum" path="res://map_room.gd" id="1_oc81s"]
+[ext_resource type="Texture2D" uid="uid://bkfsgbkx3t3oe" path="res://assets/kenney_1-bit-platformer-pack/Tiles/Transparent/tile_0241.png" id="2_vqn3c"]
[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")
+inactive_color = Color(0.7490196, 0.76862746, 0.8901961, 1)
+active_color = Color(0.5463331, 0.66674966, 1, 1)
+
+[node name="PlayerIcon" type="TextureRect" parent="."]
+layout_mode = 0
+offset_left = 2.0
+offset_right = 18.0
+offset_bottom = 16.0
+scale = Vector2(0.25, 0.25)
+texture = ExtResource("2_vqn3c")
diff --git a/room_test3.tscn b/room_test3.tscn
index c3c113f..679f828 100644
--- a/room_test3.tscn
+++ b/room_test3.tscn
@@ -458,7 +458,7 @@ position_smoothing_speed = 3.0
offset_amt = Vector2(40, 14)
[node name="DoorUp" parent="." instance=ExtResource("6_i21us")]
-position = Vector2(96, 20)
+position = Vector2(96, 10)
scale = Vector2(4, 1)
exit_towards = "DROP"
enter_towards = "JUMP"