Files
Super-Mario-Bros.-Remastere…/Scripts/UI/StoryPause.gd
KirbyKidJ 84a34ff3b9 Miscellaneous Bugfixes From My Multiplayer Branch
This is just a bunch of bugfixes I did while I was working on the Multiplayer Support PR. I know I should've kept them separate, but then I'd also be dealing with said bugs. So this PR adds most of the bugfixes I did while working on Multiplayer.

- De-globalized Pipe SFX from Pipe Cutscene (helps with lowering audio)
- De-globalized 1-up SFX for Players
- Removed an error log spam with the `ResourceSetter`s (involving connecting already connected signals)
- Made sure to insert "BaseAssets" folder into the FIRST slot in the Resource Packs array.
- Replaced `"BaseAssets"` for the above fix with `Godot.ROM_PACK_NAME`
- Removed unused `"character"` setting from `SettingsManager`
- Reset P-Switch timer when `Global.reset_values()` is called. Fixes bug when pressing a P-Switch and immediately restarting the level.
- Added Skid SFX to `AudioManager`
- Added slightly longer delay for when pausing with a controller (it can easily unpause before you press the button again)
- Null check if LevelBG is in the level or not (for added for test levels)
2025-10-05 12:12:39 -07:00

62 lines
1.5 KiB
GDScript

extends Control
var selected_index := 0
@export var options: Array[Label]
@onready var cursor: TextureRect = $Control/Cursor
var active := false
@export var is_pause := true
signal option_1_selected
signal option_2_selected
signal option_3_selected
signal option_4_selected
signal closed
func _process(_delta: float) -> void:
if active:
handle_inputs()
cursor.global_position.y = options[selected_index].global_position.y + 4
cursor.global_position.x = options[selected_index].global_position.x - 10
func handle_inputs() -> void:
if Input.is_action_just_pressed("ui_down"):
selected_index += 1
if Input.is_action_just_pressed("ui_up"):
selected_index -= 1
selected_index = clamp(selected_index, 0, options.size() - 1)
if Input.is_action_just_pressed("ui_accept"):
option_selected()
elif Input.is_action_just_pressed("pause") or Input.is_action_just_pressed("ui_back"):
close()
func option_selected() -> void:
emit_signal("option_" + str(selected_index + 1) + "_selected")
func open_settings() -> void:
active = false
$SettingsMenu.open()
await $SettingsMenu.closed
active = true
func open() -> void:
if is_pause:
Global.game_paused = true
AudioManager.play_global_sfx("pause")
get_tree().paused = true
show()
await get_tree().create_timer(0.1).timeout
active = true
func close() -> void:
active = false
selected_index = 0
hide()
closed.emit()
await get_tree().create_timer(0.1).timeout
Global.game_paused = false
get_tree().paused = false