Skip to content

Commit

Permalink
Add GDScript naming convention summary table
Browse files Browse the repository at this point in the history
Co-Authored-By: Edwin <[email protected]>
Co-Authored-By: Hugo Locurcio <[email protected]>
  • Loading branch information
3 people committed Nov 20, 2024
1 parent bed8076 commit d30acf2
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion tutorials/scripting/gdscript/gdscript_styleguide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,29 @@ Naming conventions

These naming conventions follow the Godot Engine style. Breaking these will make
your code clash with the built-in naming conventions, leading to inconsistent
code.
code. As a summary table:

+---------------+----------------+----------------------------------------------------+
| Type | Convention | Example |
+===============+================+====================================================+
| File names | snake_case | ``yaml_parser.gd`` |
+---------------+----------------+----------------------------------------------------+
| Class names | PascalCase | ``class_name YAMLParser`` |
+---------------+----------------+----------------------------------------------------+
| Node names | PascalCase | ``const Weapon = preload("res://weapon.gd")`` |
+---------------+----------------+----------------------------------------------------+
| Functions | snake_case | ``func load_level():`` |
+---------------+----------------+----------------------------------------------------+
| Variables | snake_case | ``particle_effect`` |
+---------------+----------------+----------------------------------------------------+
| Signals | snake_case | ``signal door_opened`` (always in past tense) |
+---------------+----------------+----------------------------------------------------+
| Constants | CONSTANT_CASE | ``const MAX_SPEED = 200`` |
+---------------+----------------+----------------------------------------------------+
| Enum names | PascalCase | ``enum Element`` |
+---------------+----------------+----------------------------------------------------+
| Enum members | CONSTANT_CASE | ``{EARTH, WATER, AIR, FIRE}`` |
+---------------+----------------+----------------------------------------------------+

File names
~~~~~~~~~~
Expand Down

0 comments on commit d30acf2

Please sign in to comment.