mirror of
https://github.com/JHDev2006/Super-Mario-Bros.-Remastered-Public.git
synced 2025-10-22 07:28:14 +00:00
fixed a bug where the puase menu couldnt be closed by pressing the pause button again
This commit is contained in:
@@ -14,6 +14,8 @@ signal option_2_selected
|
||||
signal option_3_selected
|
||||
signal option_4_selected
|
||||
|
||||
signal closed
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if active:
|
||||
handle_inputs()
|
||||
@@ -28,6 +30,8 @@ func handle_inputs() -> void:
|
||||
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")
|
||||
@@ -51,6 +55,7 @@ func close() -> void:
|
||||
active = false
|
||||
selected_index = 0
|
||||
hide()
|
||||
closed.emit()
|
||||
for i in 2:
|
||||
await get_tree().physics_frame
|
||||
Global.game_paused = false
|
||||
|
Reference in New Issue
Block a user