This repository has been archived on 2021-04-27. You can view files and clone it, but cannot push or open issues or pull requests.
superv/scenes/s_main/s_main.gd

32 lines
971 B
GDScript

extends Spatial
#-----------------SCENE--SCRIPT------------------#
# Close your game faster by clicking 'Esc' #
# Change mouse mode by clicking 'Shift + F1' #
#------------------------------------------------#
export var fast_close := true
var mouse_mode: String = "CAPTURED"
##################################################
func _ready() -> void:
print("SuperV Debug Terminal")
if fast_close:
print("** Fast Close enabled in the 's_main.gd' script **")
print("** 'Esc' to close 'Shift + F1' to release mouse **")
func _input(event: InputEvent) -> void:
if event.is_action_pressed("ui_cancel") and fast_close:
get_tree().quit() # Quits the game
if event.is_action_pressed("mouse_input") and fast_close:
match mouse_mode: # Switch statement in GDScript
"CAPTURED":
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
mouse_mode = "VISIBLE"
"VISIBLE":
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
mouse_mode = "CAPTURED"