Wiki
  • Homepage
  • Player's Manual
    • Controls
    • Skills
    • Objects
    • Credits
  • Contributing
    • Getting Started
      • Programs and Files
      • Cloning the GitHub Project
      • Git Structure
      • Submitting Changes
    • Level Design
      • Basic Level Setup
      • Creating Static.tscn
      • Creating Collision.tscn
      • Stage Triggers
        • Using StageTrigger.tscn
        • Camera Triggers
        • Culling Triggers
        • Death Triggers
        • Dialog Triggers
        • Jump Triggers
        • Path Triggers
        • Automation Triggers
        • Drift Triggers
        • Foothold Triggers
        • Platform Triggers
        • Sidle Triggers
      • Stage Objects
      • Placing Objects Along the Path
    • Playtesting
      • General Shortcuts
      • Debug Menu
      • Free Camera Mode
      • Using the Editor for Playtesting
    • Submitting a Bug Report
    • Documentation Style Guide
  • Asset Guidelines
    • Source Files
    • Asset Ripping Reference
      • Original Model Files
    • Asset Editing Reference
      • Editing Environment Models
      • Editing Collision Models
      • All About Curves
      • Exporting Models from Blender
    • Resources Files
      • CameraSettingsResource
    • Miscellaneous Notes
  • Godot Guidelines
    • File Guides
      • File Structure
      • Naming Files
    • Project Settings
      • Tag Reference
      • Layer Reference
    • Particle Effects
    • Audio
  • CODE GUIDELINES
    • Language Specifications
    • Formatting
    • General guidelines
    • Attributes
    • Floating Point Numbers
Powered by GitBook
On this page
  1. CODE GUIDELINES

General guidelines

PreviousFormattingNextAttributes

Last updated 8 months ago

  • Use [TAB] for create indents.

  • Use the "" for braces. You can skip braces for one-line returns (unless the condition requires a second line).

  • Use multiple early return statements when possible to prevent functions from becoming over-indented.

  • Specify each variable's type. Don't use the var keyword.

  • Use a single empty line to separate parts of code.

void Foo()
{
    // Short check
    bool isValid = CheckValidity();
    if (!isValid)
        return;
        
    // Longer checks
    if (!longerValidCheckA &&
        longerValidCheckB)
    {
        return;
    }
    
    DoSomething();
}

Allman style