GDScript Built-in Reference

Complete guide to Godot's default variables, functions, and methods

No separate declaration required - ready to use!

All Properties Methods Signals Constants Math Input
Showing 0 of 0 items

No results found

Try different keywords or clear your search

CharacterBody2D / CharacterBody3D

Properties

velocity
Movement velocity of the character body
Vector2/Vector3
velocity = Vector2(300, 0)
motion_mode
Physics motion mode (grounded or floating)
MOTION_MODE_GROUNDED / MOTION_MODE_FLOATING
up_direction
Defines which direction is "up" for floor detection
Vector2/Vector3
floor_stop_on_slope
Stop character from sliding down slopes
bool
floor_max_angle
Maximum angle considered as floor
float
wall_min_slide_angle
Minimum angle for sliding along walls
float

Methods

move_and_slide()
Move character with collision detection and sliding
void
move_and_slide()
is_on_floor()
Check if character is touching the floor
bool
if is_on_floor(): jump()
is_on_ceiling()
Check if character is touching the ceiling
bool
is_on_wall()
Check if character is touching a wall
bool
get_floor_normal()
Get the normal vector of the floor surface
Vector2/Vector3
get_wall_normal()
Get the normal vector of the wall surface
Vector2/Vector3
get_last_motion()
Last movement applied
Vector2/Vector3
get_slide_collision(index)
Get collision information
KinematicCollision2D/3D
get_slide_collision_count()
Number of collisions this frame
int

Node (Base Class)

Properties

name
The node's name in the scene tree
String
owner
The scene root that owns this node
Node

Methods

get_tree()
Access the scene tree
SceneTree
get_tree().quit()
get_parent()
Get the parent node
Node
get_children()
Get all child nodes as an array
Array
add_child(node)
Add a child node
void
add_child(enemy)
queue_free()
Delete node at end of current frame
void
queue_free()
add_to_group(group)
Add node to a group
void
add_to_group("enemies")
get_node(path)
Get node by path
Node
get_node("Player")
find_child(pattern)
Find child by name pattern
Node
set_process(enable)
Enable/disable _process()
void
is_processing()
Check if _process enabled
bool

Node2D

Properties

position
2D position in space
Vector2
position = Vector2(100, 200)
rotation
Rotation in radians
float
rotation_degrees
Rotation in degrees
float
scale
Scale (1.0 = normal size)
Vector2
global_position
World space position
Vector2
z_index
Draw order (higher = on top)
int

Methods

look_at(point)
Rotate to look at a point
void
look_at(player.position)
rotate(angle)
Rotate by angle in radians
void
translate(offset)
Move by offset
void
get_angle_to(point)
Get angle to another point
float

Node3D

Properties

position
Position in 3D space
Vector3
rotation
Rotation (Euler angles)
Vector3
rotation_degrees
Rotation in degrees
Vector3
scale
Scale
Vector3
global_position
World position
Vector3
transform
Full transformation
Transform3D

Methods

look_at(target, up)
Look at a position
void
rotate_x(angle)
Rotate around X axis
void
rotate_y(angle)
Rotate around Y axis
void
translate(offset)
Move by offset
void

Area2D / Area3D

Properties

monitoring
Detect other bodies
bool
monitorable
Can be detected by others
bool

Methods

get_overlapping_bodies()
Get bodies currently overlapping
Array
has_overlapping_bodies()
Check if any bodies overlap
bool

Signals

body_entered(body)
When a body enters the area
signal
body_exited(body)
When a body exits the area
signal

Input (Singleton)

Methods

is_action_pressed(action)
Check if action is currently held
bool
if Input.is_action_pressed("jump"):
is_action_just_pressed(action)
Check if action was just pressed this frame
bool
is_action_just_released(action)
Check if action was just released this frame
bool
get_axis(negative, positive)
Get axis value (-1.0 to 1.0)
float
var dir = Input.get_axis("left", "right")
get_vector(neg_x, pos_x, neg_y, pos_y)
Get movement vector from input
Vector2
get_mouse_position()
Get mouse position on screen
Vector2
set_mouse_mode(mode)
Set mouse mode (visible, hidden, captured)
void

Global Math Functions

Basic Math

abs(value)
Absolute value
float
sqrt(value)
Square root
float
pow(base, exp)
Power operation
float
min(a, b)
Minimum value
Variant
max(a, b)
Maximum value
Variant
clamp(value, min, max)
Constrain value between min and max
Variant
health = clamp(health, 0, 100)
lerp(from, to, weight)
Linear interpolation
Variant
pos = lerp(start, end, 0.5)
move_toward(from, to, delta)
Move value toward target by delta
float

Trigonometry

sin(angle)
Sine function
float
cos(angle)
Cosine function
float
tan(angle)
Tangent function
float
atan2(y, x)
Arctangent (returns angle)
float
deg_to_rad(degrees)
Convert degrees to radians
float
rad_to_deg(radians)
Convert radians to degrees
float

Random Functions

randf()
Random float 0.0-1.0
float
randi()
Random integer
int
randf_range(from, to)
Random float in range
float
randi_range(from, to)
Random integer in range
int
randomize()
Seed randomizer
void

Utility Functions

Print & Debug

print(...)
Print to console
void
print("Hello, World!")
print_debug(...)
Print with debug info
void
printerr(...)
Print as error
void

Type Conversion

str(value)
Convert to string
String
int(value)
Convert to integer
int
float(value)
Convert to float
float
typeof(variable)
Get type as int
int

Resource Loading

load(path)
Load resource at runtime
Resource
preload(path)
Load resource at compile time
Resource

Useful Constants

Math Constants

PI
π (3.14159...)
float
TAU
τ (2π = 6.28318...)
float
INF
Infinity
float

Vector Constants

Vector2.ZERO
Zero vector (0, 0)
Vector2
Vector2.ONE
One vector (1, 1)
Vector2
Vector2.UP
Up direction (0, -1)
Vector2
Vector2.DOWN
Down direction (0, 1)
Vector2
Vector2.LEFT
Left direction (-1, 0)
Vector2
Vector2.RIGHT
Right direction (1, 0)
Vector2
Vector3.ZERO
Zero vector (0, 0, 0)
Vector3
Vector3.UP
Up direction (0, 1, 0)
Vector3

Input Constants

MOUSE_BUTTON_LEFT
Left mouse button
int
MOUSE_BUTTON_RIGHT
Right mouse button
int
KEY_SPACE
Space key
int
KEY_ENTER
Enter key
int
KEY_ESCAPE
Escape key
int

Quick Reference Example Usage:

extends CharacterBody2D

const SPEED = 300.0
const JUMP_VELOCITY = -400.0

func _physics_process(delta):
    # Gravity
    if not is_on_floor():
        velocity.y += get_gravity().y * delta
    
    # Jump
    if Input.is_action_just_pressed("ui_accept") and is_on_floor():
        velocity.y = JUMP_VELOCITY
    
    # Movement
    var direction = Input.get_axis("ui_left", "ui_right")
    if direction:
        velocity.x = direction * SPEED
    else:
        velocity.x = move_toward(velocity.x, 0, SPEED)
    
    move_and_slide()

This covers the most commonly used built-in properties and methods. All of these are available without any import or declaration!

Ready to Build Your Game?

📱 Contact on WhatsApp