In-Game console to Godot 3.0+ for debugging purposes
Still have some work to do. Some instructions below:
Observations:
- Stay tuned in the nodes paths, otherwise you can get errors.
Default commands:
-
help = show registered commands
-
echo = print what you write after it.
-
show = print the value of some variable (must be stored in Globals.gd)
-
clear = clears log.
-
get_position = get a Vector2 position of your player (I've made a KinematicBody2D to show how it would be)
-
set_position = set the set-up player position
-
scene = goes to specified scene. (must be in Assets/Scenes/ folder)
-
First of all you'll need to call
register_command
function [Assets/Scripts/Autoload/Console.gd
], which takes a stringname
and anargs
object withdescription
,args
(both to be showed on the log) andnum_args
fields. -
Then you simply make a function with the same name as your
name
declared onto register_command calling, and setup your command actions inside this function.
This console was made with the same base logic than Calinou's one, which was made for 2.1.