Use a standard block at the very top of every script to identify ownership and purpose.
- Syntax:
#followed by*border. - Tags:
@file,@author,@date,@brief.
# ******************************************************************************
# * @file <filename>
# * @author Javier
# * @date <date>
# * @brief <description>
# ******************************************************************************
Divide the file into high-level categories using uppercase blocks.
# ************************************
# * INCLUDES
# ************************************
# e.g. extends NodeX
# ------------------------------------
# ************************************
# * PRIVATE MACROS AND DEFINES
# ************************************
# (optional)
# ------------------------------------
# ************************************
# * VARIABLES
# ************************************
Inside the VARIABLES section, group related properties using "Three Equals" headers.
example below:
# === Node References ===
@onready var sprite = $Sprite2D
# === Configuration: Movement ===
const SPEED = 100.0
# === State Variables ===
var current_health = 10
We use the Double Hash (##) syntax so Godot creates tooltips in the editor. We use Doxygen-Style tags for parameters and returns.
- Description: Short summary first. Detailed explanation (if needed) after a break.
- @param: usage:
name: description - @return: usage:
Type: description
example below:
# ************************************
# * FUNCTION DEFINITIONS
# ************************************
## Calculates the isometric projection of a vector.
## Squashes the Y-axis to create the 2.5D depth effect.
##
## @param input_vector: The Cartesian input (e.g., Input.get_vector).
## @return Vector2: The adjusted vector for isometric movement.
func to_isometric(input_vector: Vector2) -> Vector2:
return Vector2(input_vector.x - input_vector.y, (input_vector.x + input_vector.y) * 0.5)
##vs#:##shows up in the Godot Inspector when you hover over the function name in other scripts. Standard#does not.- Organization: The
=== Header ===style makes scrolling through long files (like Player controllers) much faster visually.
# ******************************************************************************
# * @file <filename>
# * @author Javier
# * @date <date>
# * @brief <description>
# ******************************************************************************
# ************************************
# * INCLUDES
# ************************************
# ************************************
# * PRIVATE MACROS AND DEFINES
# ************************************
# ************************************
# * VARIABLES
# ************************************
# ************************************
# * FUNCTION DEFINITIONS
# ************************************