Cheatography
https://cheatography.com
GDScript is a high-level, both static and dynamically typed programming language specifically designed for the Godot game engine.
This is a draft cheat sheet. It is a work in progress and is not finished yet.
Declare variables
var my_variable = 10 |
Declare a variable |
my_variable = 20 |
Change the value of a variable |
var my_int: int = 5 |
Declare a variable with a specific type |
static var my_static_variable = 30 |
Declare a static variable |
my_static_variable = 40 |
Change the value of a static variable |
MyClass.my_static_variable = 40 |
Since statics belong to the class, you can also use them |
const MY_CONSTANT = 100 |
Declare a constant |
|
Comments
"""
This is a multiline string, not a comment!
And thus it will be parsed by interpreter...
"""
# Now this
# is a multiline comments
# Interpreter will not read this
|
Variable Types
var x: int = 42 |
int: Integer numbers |
var y: float = 3.14 |
float: Floating-point numbers |
var is_active: bool = true |
bool: Boolean values (true or false) |
var name: String = "lollygag" |
String: Text strings |
var my_array: Array = [1, 2, 3, 4, 5] |
Array: Ordered list of elements |
var my_dict: Dictionary = {"key1": "value1", "key2": "value2"} |
Dictionary: Key-value pairs |
|
|
|
|
|