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

24 lines
588 B
GDScript
Raw Normal View History

2021-06-02 23:32:07 +02:00
extends Node
enum GameFocus {MENU, GAME, CHAT, AWAY}
2021-06-02 23:32:07 +02:00
@onready var gui = $GUI
@onready var hud = $HUD
@onready var player = $Level/Player
@onready var chat = hud.get_node("Chat")
var focus = GameFocus.MENU
2021-06-02 23:32:07 +02:00
func _input(event) -> void:
if Input.is_action_just_pressed("ui_cancel"):
if focus == GameFocus.GAME:
2021-06-02 23:32:07 +02:00
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
gui.show()
player.input_active = false
focus = GameFocus.MENU
elif focus == GameFocus.MENU:
2021-06-02 23:32:07 +02:00
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
gui.hide()
player.input_active = true
focus = GameFocus.GAME