objetos raros, objetos decorativos rompibles

This commit is contained in:
Diego De la Viuda Llorente committed 2026-10-29 17:11:24 +01:00
1 parent 827e16cf50
commit 66f4d8b33b
55 files changed
+4793 -163

No files matched your search

+19 -3
View File
@@ -1,6 +1,6 @@
extends Control
## Menu provisional sin seleccion de personaje, progreso ni lista manual de niveles.
## Menu provisional, coleccion persistente y selector de niveles sin lista manual.
## Solo descubre escenas directamente dentro de levels, nunca sus subcarpetas.
const LEVEL_DIRECTORY: String = "res://levels"
@@ -10,6 +10,8 @@ const LEVEL_DIRECTORY: String = "res://levels"
@onready var level_list: VBoxContainer = $Margin/Layout/Levels/Scroll/LevelList
@onready var empty_label: Label = $Margin/Layout/Levels/Empty
@onready var play_button: Button = $Margin/Layout/Home/Play
@onready var inventory_panel: VBoxContainer = $Margin/Layout/RareInventory
@onready var inventory_button: Button = $Margin/Layout/Home/RareItems
@onready var quit_button: Button = $Margin/Layout/Home/Quit
@onready var back_button: Button = $Margin/Layout/Levels/Back
@onready var error_label: Label = $Margin/Layout/Error
@@ -24,6 +26,8 @@ func _ready() -> void:
set_process(false)
play_button.pressed.connect(_show_levels)
back_button.pressed.connect(_show_home)
inventory_button.pressed.connect(_show_inventory)
inventory_panel.connect("back_requested", _show_home)
quit_button.pressed.connect(_quit_game)
# En web no se puede cerrar la pestana desde el juego.
quit_button.visible = not OS.has_feature("web")
@@ -54,6 +58,7 @@ static func level_label(path: String) -> String:
func _show_home() -> void:
if not _loading_path.is_empty():
return
inventory_panel.hide()
home_panel.show()
levels_panel.hide()
loading_panel.hide()
@@ -81,6 +86,7 @@ func _show_levels() -> void:
button.pressed.connect(_load_level.bind(path))
level_list.add_child(button)
empty_label.visible = paths.is_empty()
inventory_panel.hide()
home_panel.hide()
levels_panel.show()
error_label.hide()
@@ -91,6 +97,16 @@ func _show_levels() -> void:
back_button.grab_focus()
func _show_inventory() -> void:
if not _loading_path.is_empty():
return
home_panel.hide()
levels_panel.hide()
error_label.hide()
title_label.text = "OBJETOS RAROS"
inventory_panel.call("show_collection")
## La pantalla de carga real no introduce otros diez segundos artificiales.
func _load_level(path: String) -> void:
if not _loading_path.is_empty():
@@ -142,14 +158,14 @@ func _show_load_error(message: String) -> void:
func _unhandled_input(event: InputEvent) -> void:
if event.is_action_pressed("ui_cancel") and _loading_path.is_empty() and levels_panel.visible:
if event.is_action_pressed("ui_cancel") and _loading_path.is_empty() and (levels_panel.visible or inventory_panel.visible):
_show_home()
get_viewport().set_input_as_handled()
func _notification(what: int) -> void:
if what == NOTIFICATION_WM_GO_BACK_REQUEST and is_node_ready() and _loading_path.is_empty():
if levels_panel.visible:
if levels_panel.visible or inventory_panel.visible:
_show_home()
else:
_quit_game()