WIP checkpoint: PC2: Wire "Enter World" from the browse list to the playable level
This commit is contained in:
+3
-5
@@ -79,13 +79,11 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
_update_input_direction(key)
|
||||
elif not key.pressed:
|
||||
_clear_input_direction(key)
|
||||
# Release the mouse so the player can get back to a menu/cursor.
|
||||
# Escape exits the level back to the world browse list, mirroring
|
||||
# the Back button pattern already used in world_list.gd/main_menu.gd.
|
||||
if key.pressed and key.keycode == KEY_ESCAPE:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
elif event is InputEventMouseButton and event.pressed:
|
||||
# Clicking back into the viewport re-captures the mouse.
|
||||
if Input.mouse_mode == Input.MOUSE_MODE_VISIBLE and DisplayServer.get_name() != "headless":
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
get_tree().change_scene_to_file("res://scenes/world_list.tscn")
|
||||
elif event is InputEventMouseMotion and Input.mouse_mode == Input.MOUSE_MODE_CAPTURED:
|
||||
_handle_mouse_look(event as InputEventMouseMotion)
|
||||
|
||||
|
||||
@@ -135,8 +135,23 @@ func _create_world_card(world_dict: Dictionary) -> Control:
|
||||
meta_label.add_theme_font_size_override("font_size", 12)
|
||||
meta_label.add_theme_color_override("font_color", Color(0.5, 0.5, 0.5, 1.0))
|
||||
|
||||
# PC2: the only thing a world actually loads into right now is the one
|
||||
# shared playable test level (scenes/game.tscn) -- there's no per-world
|
||||
# content yet, so "Enter" doesn't need the world's id for anything.
|
||||
# Real per-world level loading is a later concern once worlds actually
|
||||
# have their own content to load.
|
||||
var enter_button := Button.new()
|
||||
enter_button.text = "Enter World"
|
||||
enter_button.size_flags_horizontal = Control.SIZE_SHRINK_BEGIN
|
||||
enter_button.pressed.connect(_on_enter_world_pressed)
|
||||
|
||||
card.add_child(name_label)
|
||||
card.add_child(desc_label)
|
||||
card.add_child(meta_label)
|
||||
card.add_child(enter_button)
|
||||
|
||||
return panel
|
||||
|
||||
|
||||
func _on_enter_world_pressed() -> void:
|
||||
get_tree().change_scene_to_file("res://scenes/game.tscn")
|
||||
|
||||
Reference in New Issue
Block a user