godot-gdscript
Fungsinya
Skill ini mengajari agent cara menulis GDScript yang benar untuk Godot 4, bahasa skrip yang sudah terpasang di Godot. Skill ini ditujukan untuk orang yang membuat game dengan Godot.
Kapan dipakai
- βSaat Anda menulis atau memperbaiki file GDScript dalam proyek Godot.
- βSaat Anda ingin menambahkan pengaturan yang diekspor, koneksi sinyal, atau pemanggilan await pada skrip Godot.
- βSaat Anda memindahkan skrip Godot 3 yang lama ke Godot 4 dan skrip itu tidak lagi berjalan.
Link skill
https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/godot/godot-gdscript/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βSkrip Godot saya menampilkan error setelah pembaruan ke Godot 4. Bisakah Anda memperbaikinya untuk saya?β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
Skill menjelaskan cara memberi tipe pada variabel dan fungsi, memakai fungsi siklus hidup node bawaan, serta memakai sinyal dan await, sehingga agent menulis kode seperti yang diharapkan Godot.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari GitHub.
Godot GDScript (4.x)
Write correct, statically typed GDScript and use the node lifecycle and signal system the way the engine intends. Targets Godot 4.7 (GDScript 2.0).
When to use
- Use when writing or fixing
.gdfiles: declaring variables, functions, classes, using@export/@onready, connecting signals, or awaiting coroutines/signals. - Use when porting Godot 3.x scripts to 4.x and the script no longer parses.
When not to use: scene/node structure and instancing questions β
godot-nodes-scenes; signal architecture/decoupling patterns β
godot-signals-groups; using C# instead of GDScript β godot-csharp.
Core workflow
- Type everything you can. GDScript 2.0 supports static types
(
var hp: int = 10,func add(a: int, b: int) -> int:). Types catch errors at parse time and speed up the VM. Use:=for inferred types. - Use the lifecycle callbacks for their purpose:
_ready()once when the node and its children enter the tree;_process(delta)every rendered frame;_physics_process(delta)on the fixed physics tick (use it for movement/physics). - Grab node references with
@onready, not in_init()β children do not exist until the node enters the tree. - Expose tunables with
@exportso designers edit them in the Inspector. - React to events with signals +
await, not polling, where it reads cleanly. - Run and read errors. The Debugger panel prints typed errors with line numbers; fix the first error first (later ones are often cascades).
Patterns
1. A typed script with lifecycle, @export, and @onready
extends Node2D
class_name Spinner # registers a global type usable in other scripts
@export var speed: float = 90.0 # editable in the Inspector (degrees/sec)
@export_range(0, 10, 0.5) var wobble := 2.0
@onready var sprite: Sprite2D = $Sprite2D # resolved when the node enters the tree
func _ready() -> void:
# Runs once, after children are ready. Safe to touch $Sprite2D here.
sprite.modulate = Color.AQUA
func _process(delta: float) -> void:
# delta is seconds since last frame; multiply rates by it for FPS independence.
rotation_degrees += speed * delta
2. Signals: declare, emit, connect (4.x Callable syntax)
extends Node
signal health_changed(current: int, maximum: int) # typed signal params
var health := 100
func take_damage(amount: int) -> void:
health = maxi(health - amount, 0) # maxi/maxf are typed; max() returns Variant
health_changed.emit(health, 100) # 4.x: emit as a method on the signal
func _ready() -> void:
# 4.x: connect with a Callable, not a string method name.
health_changed.connect(_on_health_changed)
func _on_health_changed(current: int, maximum: int) -> void:
print("HP: %d/%d" % [current, maximum])
3. await β pause until a timer or signal fires (replaces 3.x yield)
func flash_then_continue() -> void:
modulate = Color.RED
await get_tree().create_timer(0.2).timeout # resume after 0.2s
modulate = Color.WHITE
# await any signal: var result = await some_node.some_signal
4. Lambdas, typed arrays, and safe access
var enemies: Array[Node] = [] # typed array
func cull_dead() -> void:
enemies = enemies.filter(func(e): return e.is_inside_tree())
func get_first_name(d: Dictionary) -> String:
return d.get("name", "unknown") # default avoids missing-key errors
Pitfalls
- 3.x β 4.x signal API changed.
emit_signal("x")still works but preferx.emit(...);connect("x", self, "_on_x")is gone β usex.connect(_on_x)with a Callable.yield(obj, "sig")is nowawait obj.sig. export varis now@export var(annotation). Likewiseonreadyβ@onready,toolβ@tool,remote/masterRPC keywords β the@rpc(...)annotation.@onreadyand$NodePathin_init()fail β the node isn't in the tree yet. Initialize node references in_ready()or with@onready.- Integer division truncates.
5 / 2 == 2. Use5.0 / 2or cast tofloat. _processvs_physics_process. Putmove_and_slide()and physics in_physics_process(delta); using_processmakes motion frame-rate dependent.class_namemust be unique project-wide and is required to use the type name in other scripts or as an Inspector type.- **An override stops parsing after upgrading to
Pertanyaan umum
Apa itu GDScript?
GDScript adalah bahasa skrip yang sudah terpasang di Godot, dengan gaya yang mirip Python.
Apakah ini bisa membantu proyek Godot 3 yang lama?
Ya. Skill mencakup perubahan dari Godot 3 ke Godot 4, seperti yield menjadi await dan export menjadi @export.
Apakah skill ini untuk kode C#?
Tidak. Kode C# di Godot dicakup oleh skill terpisah.
Detail
Deskripsi asli dari pembuat
Write idiomatic GDScript for Godot 4.7: static typing, the node lifecycle (_ready/_process/_physics_process), @export/@onready/@tool annotations, signals, and await for asynchronous flow. Use when editing .gd scripts in a Godot project (project.godot), writing or debugging GDScript, or porting 3.x GDScript to 4.x (function signatures, yield to await, export to @export).
Popularitas
- Bintang GitHub
- 6.6k
- Peringkat
- #13823
- Lisensi
- Apache-2.0
- Diperbarui
- 28/10/2026
Komentar
- β¦
Skill lain dari repositori ini
router
6.6kMembantu agent Anda memilih skill pengembangan game yang tepat untuk setiap permintaan dengan mendeteksi engine Anda dan jenis tugas yang Anda perlukan.
ai-behavior-trees-utility-ai
6.6kMembantu agent Anda membangun behavior tree dan sistem utility AI untuk musuh dan karakter game yang memilih aksi berdasarkan prioritas dan skor.
audio-design
6.6kMengajari agent Anda cara mixing audio game: bus, volume dalam desibel, ducking di bawah dialog, musik adaptif, dan variasi efek suara.
camera-systems
6.6kMembantu agent Anda membangun kamera game yang mengikuti dengan halus, tetap berada di dalam level, dan dapat mengorbit atau melihat sekeliling dalam 3D.
Skill serupa
diffs
394kMemungkinkan agent Anda menghasilkan diff perubahan yang nyata dan dapat dibagikan sebagai tautan viewer atau file gambar, bukan ringkasan yang ditulis manual.
coding-agent
394kMembantu agent Anda menyerahkan pekerjaan pemrograman besar ke Codex, Claude Code, atau OpenCode di latar belakang, lalu memeriksa kemajuannya.
gh-issues
394kMembantu agent Anda menemukan issue GitHub, memilih yang dikerjakan, dan membuka pull request perbaikan, termasuk tindak lanjut komentar tinjauan.