--- a/scenes/mission_menu_screen.tscn +++ b/scenes/mission_menu_screen.tscn @@ -33,10 +33,3 @@ text = " * High Scores" order_number = 1 -[node name="ExitItem" parent="." instance=ExtResource("2_n0jtc")] -offset_left = 8.0 -offset_top = 56.0 -offset_right = 136.0 -offset_bottom = 64.0 -text = " * Exit" -order_number = 2 --- a/scenes/pause_menu.tscn +++ b/scenes/pause_menu.tscn @@ -53,14 +53,6 @@ text = "Main Menu" order_number = 2 -[node name="ExitMenuItem" parent="." instance=ExtResource("3_vagpt")] -layout_mode = 0 -offset_left = 16.0 -offset_top = 80.0 -offset_right = 104.0 -offset_bottom = 90.0 -text = "Exit" -order_number = 3 [node name="SwitchStreamPlayer" type="AudioStreamPlayer" parent="."] stream = ExtResource("5_mvrue") @@ -71,5 +63,3 @@ [connection signal="selection" from="RestartMenuItem" to="." method="select"] [connection signal="clicked" from="MainMenuMenuItem" to="." method="choose"] [connection signal="selection" from="MainMenuMenuItem" to="." method="select"] -[connection signal="clicked" from="ExitMenuItem" to="." method="choose"] -[connection signal="selection" from="ExitMenuItem" to="." method="select"] --- a/scripts/pause_menu.gd +++ b/scripts/pause_menu.gd @@ -3,6 +3,8 @@ var menu_item_list: Array[Node] var current_selection: int = 0 +# fredygames: quadro de fisica em que a pausa abriu (ver _physics_process). +var opened_frame: int = -1 func resume(): @@ -54,17 +56,21 @@ func _ready(): - menu_item_list = [$ResumeMenuItem, $RestartMenuItem, $MainMenuMenuItem, $ExitMenuItem] + # fredygames: sem "Exit" no navegador (get_tree().quit() so congela a pagina). + menu_item_list = [$ResumeMenuItem, $RestartMenuItem, $MainMenuMenuItem] ($ResumeMenuItem as MenuItem).set_selected(true) + visibility_changed.connect(func(): opened_frame = Engine.get_physics_frames()) func _physics_process(_delta): if Input.is_action_just_pressed("menu_up"): select(max(0, current_selection-1)) if Input.is_action_just_pressed("menu_down"): - select(min(3, current_selection+1)) + select(min(2, current_selection+1)) if Input.is_action_just_pressed("menu_select"): choose(current_selection) - if Input.is_action_just_pressed("menu_cancel"): + # fredygames: Esc abre a pausa e tambem e "menu_cancel"; no Godot 4.5 o action_release() do game_scene nao + # limpa o "just pressed" do mesmo quadro e a pausa fechava na hora. So vale a partir do quadro seguinte. + if Input.is_action_just_pressed("menu_cancel") and Engine.get_physics_frames() > opened_frame: resume()