banner
xingli

xingli

猫娘爱好者

GDScript Tutorial

Download Godot#

  1. You can download the original version of Godot engine from the official website.

Advantages: Supports multiple platforms such as Linux, Windows, and Mac.

The Mono version supports other languages such as C#.

Download here

  1. Godot Enhanced Edition

Download here

  1. Use this link to download Godot Enhanced Edition 3.4.4 (not the latest version).

godot3.4.4.exe

This version is for Windows.

Common Syntax#

Var + name // Same usage as C#

Specify content

① name = 123

② var name = 123 // Specify type when assigning a value, must be initialized.

Once specified, the content cannot be changed to another type.

int type rounds towards 0, float rounds down when assigning a value.

Type is automatically determined based on the content.

Can use ' ' and " "

Supports Chinese characters.

Converts variable to string using str(variable).

Two-dimensional vectors

Var vec2 = Vector2.ZERO

Var vec3 = Vector3.ZERO

Object types

Var obj = { }

Host types

Var arr = [ ]

Conditional Statements#

img

Note:

img

When elif statements exist and multiple conditions are met, the previous one is executed first.

Common if Conditions#

img

!= not

You understand, pay attention to the symbols.

Empty variables default to false.

Empty default values are 0.

Other values are true.

Comments#

Ctrl + k for batch commenting.

# for line comments.

Loops#

for loop#

img

A loop from 0 to 5.

while loop

img

Arrays#

img

Simple usage

img

Adding multiple content

img

Objects#

img

Stores variables in an array-like manner.

Values can be accessed like an array.

Functions#

Basic usage of functions

img

Output#

Prefix variables with export

Allows real-time preview and modification of data in the root node.

Graphical Layering#

img

queue_free()

Deletes the parent node.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.