Primitive Types
- Style: Lowercase
- Examples:
int
, float
, bool
, string
- Built-in primitive types are always written in lowercase.
Classes
- Style: PascalCase
- Examples:
Node
, Sprite
, KinematicBody
- Custom classes also use PascalCase:
PlayerCharacter
, EnemySpawner
.
Class Names
- Declared with the
class_name
keyword in PascalCase.
Example:
Variables
- Style: snake_case
- Examples:
player_health
, enemy_count
, movement_speed
Private Variables
- Prefix with an underscore to indicate internal use:
_internal_data
.
Example:
@onready Variables
- Use snake_case with the
@onready
annotation.
Example:
Export Variables
- Use snake_case, optionally with categories.
Examples:
Constants
- Style: UPPER_SNAKE_CASE
- Examples:
MAX_SPEED
, GRAVITY
, PI
- Defined with the
const
keyword.
Functions
- Style: snake_case
- Examples:
move_player()
, calculate_score()
, spawn_enemy()
Built-in Callback Functions
- Prefix with an underscore:
_ready()
, _process()
.
Setters and Getters
- Use
set_
and get_
prefixes.
Examples: set_health()
, get_health()
Signals
- Style: snake_case
- Examples:
health_depleted
, score_changed
, enemy_spawned
Enums
- Style: PascalCase for the enum name, UPPER_SNAKE_CASE for values.
Example:
File Names
- Style: snake_case
- Examples:
player_controller.gd
, main_menu.tscn
- For named classes, convert PascalCase to snake_case.
Example:
Node Names (Scene Tree)
- Style: PascalCase
- Examples:
PlayerSprite
, EnemyContainer
, UIPanel
Acronyms in Names
- Treat acronyms as words.
Classes/Types: HttpRequest
(not HTTPRequest
)
Variables/Functions: json_data
(not JSON_data
)
Boolean Variables
- Begin with
is_
, has_
, or can_
to improve clarity.
Examples: is_active
, has_ammo
, can_jump