lobby level

This commit is contained in:
2026-08-26 20:38:07 +03:00
parent 40c1b8e680
commit 09ae6bfbf4
3 changed files with 56 additions and 7 deletions
+9 -6
View File
@@ -217,7 +217,7 @@ func _unhandled_input(event: InputEvent) -> void:
if event is InputEventKey and event.pressed and not event.echo:
if _game_over and event.physical_keycode in [KEY_ENTER, KEY_KP_ENTER]:
if _result_win:
_continue_to_map()
_continue_to_lobby()
else:
_restart()
elif event.physical_keycode == KEY_TAB and not _game_over:
@@ -238,12 +238,15 @@ func _restart() -> void:
get_tree().reload_current_scene()
# A cleared arena advances the run: commit the win and open the map to pick the next node.
func _continue_to_map() -> void:
# A cleared level advances the run and drops the player into the lobby hub: commit the
# win, flag the lobby as the active level, then reload the shell so it builds the lobby.
# (Choosing the next map node happens from the lobby via trigger areas, added later.)
func _continue_to_lobby() -> void:
get_tree().paused = false
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
Run.complete_current_level()
get_tree().change_scene_to_file("res://levels/MapScreen.tscn")
Run.go_to_lobby()
get_tree().change_scene_to_file(Run.active_level().scene_path)
func _toggle_controls() -> void:
@@ -400,7 +403,7 @@ func _build_game_over() -> void:
# Win → Continue to the run map; loss → Go Again from the top. Shown per-result in
# _show_game_over; both share the Enter shortcut.
_over_continue = _make_button("Continue (Enter)")
_over_continue.pressed.connect(_continue_to_map)
_over_continue.pressed.connect(_continue_to_lobby)
row.add_child(_over_continue)
_over_again = _make_button("Go Again (Enter)")
+25
View File
@@ -0,0 +1,25 @@
[gd_scene format=3 uid="uid://32nyipcwrab5"]
[ext_resource type="PackedScene" uid="uid://cwmo5vh738x6w" path="res://Assets/Lobby_level.glb" id="1_lobby"]
[sub_resource type="Environment" id="Environment_lobby"]
[node name="lobby_level" type="Node3D"]
[node name="Lobby_level" parent="." instance=ExtResource("1_lobby")]
[node name="Lights" type="Node3D" parent="."]
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="Lights"]
transform = Transform3D(1, 0, 0, 0, 0.7071067, 0.70710677, 0, -0.70710677, 0.7071067, 0, 36.945946, 70)
light_color = Color(1, 0.9137255, 0.827451, 1)
light_energy = 1.6
shadow_enabled = true
[node name="DirectionalLight3D2" type="DirectionalLight3D" parent="Lights"]
transform = Transform3D(1, 0, 0, 0, -0.8660254, 0.49999994, 0, -0.49999994, -0.8660254, 0, 112.56815, 93.37274)
light_color = Color(0.4784314, 0.6156863, 0.8, 1)
light_energy = 0.45
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_lobby")
+22 -1
View File
@@ -15,6 +15,7 @@ signal run_started
const _SHELL_SCENE := "res://scene.tscn"
const _ARENA_LEVEL := preload("res://levels/arena_level.tscn")
const _BEAR_LEVEL := preload("res://levels/bear_level.tscn")
const _LOBBY_LEVEL := preload("res://levels/lobby_level.tscn")
# Map shape. Small + placeholder for now; the final row is a single boss node.
const _ROWS := 5
@@ -33,6 +34,11 @@ var pending_col: int = -1
## Debug override — when set, active_level() returns this regardless of map state.
## Set via the console `level` command; cleared on start_new_run().
var debug_level_override: LevelDef = null
## The lobby is an interstitial hub between fights, not a map node: the player is sent
## here after clearing a level (go_to_lobby()) to move around freely before choosing the
## next node. While set, active_level() serves the lobby; cleared once a node is picked
## (select_node) or a fresh run begins.
var enter_lobby: bool = false
# Level catalog. Every level shares the shell scene; what changes is the level module
# (its geometry + spawners) and the opponent. The arena (matador wave, normal + boss
@@ -43,6 +49,7 @@ const _BEAR_SCENE := preload("res://Bear.tscn")
var _arena: LevelDef
var _arena_boss: LevelDef
var _bear: LevelDef
var _lobby: LevelDef
func _ready() -> void:
@@ -52,6 +59,8 @@ func _ready() -> void:
)
_bear = _make_level(&"bear", "Bear's Den", _BEAR_LEVEL, Color(0.55, 0.38, 0.22), false)
_bear.enemy_scene = _BEAR_SCENE
# The lobby is a fightless hub — no enemy_scene, so no wave spawns and no win/lose.
_lobby = _make_level(&"lobby", "Lobby", _LOBBY_LEVEL, Color(0.62, 0.66, 0.72), false)
func _make_level(
@@ -72,6 +81,8 @@ func _make_level(
func active_level() -> LevelDef:
if debug_level_override != null:
return debug_level_override
if enter_lobby:
return _lobby
var n := node_at(pending_row, pending_col)
if n == null:
n = current_node()
@@ -84,12 +95,13 @@ func get_level(id: StringName) -> LevelDef:
&"arena": return _arena
&"arena_boss": return _arena_boss
&"bear": return _bear
&"lobby": return _lobby
return null
## All known level ids — shown by `level` in the console.
func level_ids() -> Array[StringName]:
return [&"arena", &"arena_boss", &"bear"]
return [&"arena", &"arena_boss", &"bear", &"lobby"]
## Begin a fresh run: build a new map and place the player at the start gate. Called from
@@ -101,6 +113,7 @@ func start_new_run() -> void:
pending_row = -1
pending_col = -1
debug_level_override = null
enter_lobby = false
run_started.emit()
@@ -156,10 +169,18 @@ func run_complete() -> bool:
func select_node(node: MapNode) -> void:
if node == null:
return
enter_lobby = false
pending_row = node.row
pending_col = node.col
## Send the player to the lobby hub instead of a fight — active_level() serves the lobby
## until a node is picked. Called after clearing a level so the player lands in the lobby
## rather than jumping straight to the next fight.
func go_to_lobby() -> void:
enter_lobby = true
## Commit the level just won: move the player onto the pending node (or leave them at the
## start gate after the intro fight, which has no pending node).
func complete_current_level() -> void: