project_teddy/scripts/console.gd

50 lines
1.5 KiB
GDScript3
Raw Normal View History

extends Node
var scenePlayground = "res://scenes/playground.tscn"
var sceneTutorial = "res://scenes/tutorial.tscn"
func _ready():
pass
func _process(delta):
if not Global.consoleOpen:
self.queue_free()
if Input.is_action_just_pressed("console_send"):
Global.consoleCommand = $consoleEdit.text
print (Global.consoleCommand)
run_command(Global.consoleCommand)
func run_command(command):
if command == "tele playground":
get_tree().change_scene_to_file(scenePlayground)
Global.consoleOutput = "Teleported to Playground!"
elif command == "tele tutorial":
get_tree().change_scene_to_file(sceneTutorial)
Global.consoleOutput = "Teleported to Tutorial!"
elif command == "which scene":
Global.consoleOutput = get_tree().get_current_scene().get_name()
elif command == "iamgod":
if not Global.godMode:
Global.consoleOutput = "God mode activated"
Global.godMode = true
elif Global.godMode:
Global.consoleOutput = "God mode deactivated"
Global.godMode = false
elif command == "exit":
Global.consoleOutput = "Byeee loser"
get_tree().quit()
elif command == "paul":
Global.consoleOutput = "Yuppp that's me"
elif command == "jayden":
Global.consoleOutput = "That's the noob artist"
2023-02-07 13:22:31 -07:00
elif command == "resetvars":
Global.consoleOutput = "Reset variables"
Global.reset_variables()
elif command in ["suicide", "kill", "die"]:
Global.consoleOutput = "Oh you didn't want to die?"
Global.playerHealth = 0
else:
Global.consoleOutput = "Unknown cheat code"
$output.text = Global.consoleOutput