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

48 lines
1.2 KiB
GDScript3
Raw Normal View History

2020-09-27 21:29:46 +00:00
extends Node2D
signal dismissed
func _ready() -> void:
$CanvasLayer/VBoxContainer/ResumeBtn.grab_focus()
AudioManager.set_volume()
2020-09-27 21:29:46 +00:00
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)
2020-09-27 21:29:46 +00:00
func _on_ResumeBtn_pressed() -> void:
$AnimationPlayer.play_backwards("fade")
AudioManager.set_volume(.2, AudioManager._DESIRED_VOLUME)
2020-09-27 21:29:46 +00:00
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)
2020-09-29 01:36:57 +00:00
GameState.go_to_main_menu()
2020-09-27 21:29:46 +00:00
queue_free()
func _on_NewGameBtn_pressed() -> void:
$AnimationPlayer.play_backwards("fade")
yield($AnimationPlayer, "animation_finished");
emit_signal("dismissed")
2020-09-29 01:36:57 +00:00
GameState.start_new_game()
pass # Replace with function body.
func _on_btn_focus_entered() -> void:
pass # Replace with function body.