This repository has been archived on 2022-01-09. You can view files and clone it, but cannot push or open issues/pull-requests.
liblast/Game/Main.gd

19 lines
519 B
GDScript
Raw Normal View History

2021-06-02 23:32:07 +02:00
extends Node
enum GameFocus {IN_MENU, PLAYING, TYPING, AFK}
2021-06-02 23:32:07 +02:00
var mode = GameFocus.IN_MENU
2021-06-02 23:32:07 +02:00
func _input(event) -> void:
if Input.is_action_just_pressed("ui_cancel"):
if mode == GameFocus.PLAYING:
2021-06-02 23:32:07 +02:00
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
$CanvasLayer/GUI.show()
$Level/Player.input_active = false
mode = GameFocus.IN_MENU
elif mode == GameFocus.IN_MENU:
2021-06-02 23:32:07 +02:00
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
$CanvasLayer/GUI.hide()
$Level/Player.input_active = true
mode = GameFocus.PLAYING