What is GDScript?
- Game Development course
- Beginner
- Lesson 67/83
- 4 min
Learn that GDScript is a Python-like language for Godot.
What is GDScript?
GDScript is a high-level, dynamically typed scripting language designed specifically for Godot Engine, heavily inspired by Python syntax. It uses indentation instead of curly braces and offers outstanding readability.
# GDScript offers a clean and readable structure
extends Node
func _ready():
print("GDScript ready!")Because it integrates directly with Godot's C++ core, it provides immense speed and flexibility when controlling game objects.
Script integration with Godot
GDScript code files are saved with the .gd extension. Each written script typically attaches to a Node in the scene, granting it movement, AI, or interaction abilities.
# Basic script example attaching to a Node
extends Node
func _ready():
var title = "Godot"
print(title)This allows every node in the scene to host its own independent behavior logic.
Practice Print GDScript language name
Assign "GDScript" to the language variable and print Language: GDScript to the console using the print function.
Starter code
extends Node
func _ready():
# language degiskenini tanimla ve yazdir
passSample solution
extends Node
func _ready():
var language = "GDScript"
print("Language: " + language)Expected output
Language: GDScript
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Which popular programming language's syntax fundamentally inspired GDScript?
- C++
- Python Correct answer
- Rust
- PHP
Explanation: GDScript adopts Python's indentation-based clean syntax and optimizes it specifically for the game engine.
2 Inherit from base Node class
extends ____
extends Node
Explanation: In Godot, foundational scripts attached to scene nodes inherit from the Node class.
3 GDScript core concepts
| Term | Meaning |
|---|---|
GDScript |
Python-like script language for Godot |
Indentation |
Defining blocks with whitespace |
.gd |
Standard GDScript file extension |
Scripting |
Coding behaviors for game objects |