GDScript for Python Developers
Move from Python to Godot 4 GDScript: typing, collection ownership, scripts, objects, signals and failure contracts. Build a tested stock depot through 48 real multi-file console lessons.
Python and GDScript side by side
The same program in Python and in GDScript, from the lessons of this course.
Text and Comments
Indentation and # comments will look familiar from Python, but executable GDScript statements belong inside functions. The runner constructs a Node and calls _ready; a script is not executed like a Python module body. print adds a newline, but multiple…
Python1print("tag", 7)2print("# data")GDScript1extends Node2 3func _ready() -> void:4 print("tag", 7)5 print("# data")Branches and Values
GDScript uses if, elif and else with indentation and colons. Its conditional expression puts the selected value first, as Python does: value_if_true if condition else value_if_false. Do not confuse that expression with a statement block. Conditions are…
Python1n = -22print("west" if n < 0 else "east")GDScript1extends Node2 3func _ready() -> void:4 var n: int = -25 print("west" if n < 0 else "east")Array Operations
Python lists and GDScript Arrays are ordered, growable containers. Indices can be negative to count from the end. A plain Array can hold mixed Variant values. append changes the array; it is not a way to obtain a new independently owned sequence. Bounds must…
Python1items = [3]2items.append(8)3print(items.pop(), len(items))GDScript1extends Node2 3func _ready() -> void:4 var items: Array = [3]5 items.append(8)6 var removed = items.pop_back()7 print("%d %d" % [removed,items.size()])String Operations
Python strings are immutable; GDScript strings have value semantics with copy-on-write storage. Methods such as replacing or trimming return a new string rather than modifying an existing string in place. GDScript uses + for concatenation and provides methods…
Python1s = "a-b-a"2t = s.replace("-", "/")3print(s, t)GDScript1extends Node2 3func _ready() -> void:4 var s: String = "a-b-a"5 var t: String = s.replace("-","/")6 print(s," ",t)Scripts as Classes
A GDScript file is a class, unlike a Python module that can contain many unrelated classes and free functions. extends chooses its base; class_name registers a global script name. This course gives each data type a separate snake_case file and uses RefCounted…
Python1class Token:2 def __init__(self): self.text = "blue"3a = Token()4b = a5b.text = "gold"6print(a.text)GDScript1class_name DemoToken2extends RefCounted3var text: String = "blue"Inheritance and Super
Python supports multiple inheritance and resolves methods through an MRO. GDScript has one base class per script. extends can name a registered script class; overridden methods can call the parent implementation with super. A subclass is still an instance of…
Python1class Base:2 def label(self): return "base"3class Child(Base):4 def label(self): return super().label() + "!"5print(Child().label())GDScript1class_name DemoBase2extends RefCounted3func label() -> String:4 return "base"
Syllabus
10 chapters48 lessons1 project48 challenges99 quiz questionsScripts and Scalar Values
6 lessonsFlow and Functions
6 lessonsCollection Ownership
6 lessonsText and Callable Values
3 lessonsObjects and State
5 lessonsObject Relationships
5 lessonsEvents and Failure
5 lessonsBoundaries and Lifetimes
6 lessonsConnected Stock Depot
Project4 lessonsFinal Ports
2 lessonsFrequently asked questions
Who is GDScript for Python Developers for?
For people who already write Python and want to learn GDScript. Each lesson starts from Python you know and shows how GDScript does the same thing, so you skip the beginner basics.
Do I need to know GDScript already?
No. The course starts with your first GDScript program. You need Python basics: variables, conditions, loops, functions and collections.
How many lessons does GDScript for Python Developers have?
GDScript for Python Developers contains 48 interactive lessons you can complete at your own pace.
What does GDScript for Python Developers cover?
The course is organized into chapters covering: Scripts and Scalar Values, Flow and Functions, Collection Ownership, Text and Callable Values, and more.
Is GDScript for Python Developers free?
Yes. Every course on Coddy is free to start. You can complete lessons in your browser without any downloads or signup.