platformer-game-test/src/Menu/PauseMenu.gd

47 lines
1.2 KiB
GDScript

extends Node2D
signal dismissed
func _ready() -> void:
$CanvasLayer/VBoxContainer/ResumeBtn.grab_focus()
AudioManager.set_volume()
func dismiss()->void:
_on_ResumeBtn_pressed()
func _input(event: InputEvent) -> void:
if Input.is_action_just_pressed("pause"):
_on_ResumeBtn_pressed()
return
if Input.is_action_just_pressed("ui_up") or Input.is_action_just_pressed("ui_down"):
AudioManager.play_sfx(AudioManager.Sfx.UI_MOVE)
func _on_ResumeBtn_pressed() -> void:
$AnimationPlayer.play_backwards("fade")
AudioManager.set_volume(.2, AudioManager._DESIRED_VOLUME)
yield($AnimationPlayer, "animation_finished");
emit_signal("dismissed")
queue_free()
pass # Replace with function body.
func _on_ExitToMainMenuBtn_pressed() -> void:
$AnimationPlayer.play_backwards("fade")
yield($AnimationPlayer, "animation_finished");
emit_signal("dismissed")
AudioManager.play_music(AudioManager.Music.Intro, .2)
GameState.go_to_main_menu()
queue_free()
func _on_NewGameBtn_pressed() -> void:
$AnimationPlayer.play_backwards("fade")
yield($AnimationPlayer, "animation_finished");
emit_signal("dismissed")
GameState.start_new_game()
pass # Replace with function body.
func _on_btn_focus_entered() -> void:
pass # Replace with function body.