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" onready var camera = get_node("Player/Head/Camera") ################################################## func _ready() -> void: 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" func _process(delta): var pos = camera.get_global_transform().origin get_node("Label").text = "X: "+str(pos.x)+", Y: "+str(pos.y)+", Z: "+str(pos.z) var rotation = camera.rotation get_node("Label").text += " X: "+str(rotation.x)+", Y: "+str(rotation.y)+", Z: "+str(rotation.z) func _on_Button_pressed(): get_tree().quit()