77 game-dev skills for AI coding agents — Godot, Unity, Unreal, Phaser, PixiJS, three.js, Bevy, pygame, LÖVE, Roblox. Portable SKILL.md Agent Skills (the format Anthropic launched as Claude Skills), with a router that loads the right skill for your engine and task. Runs in Claude Code, Cursor, Kiro, Codex, Copilot, Gemini CLI and more.
Python agent-skillsai-agentsantigravityawesome-listclaude-codeclinecodexcursorgame-devgame-developmentgamedevgemini-cligithub-copilotgodotkirooh-my-piskillsunityunrealwindsurf
feat(godot): add godot-gdscript, godot-nodes-scenes, godot-signals-groups skills
AbhishekBarali17e541a29add5
diff --git a/skills/godot/godot-gdscript/SKILL.md b/skills/godot/godot-gdscript/SKILL.mdnew file mode 100644index 0000000..a77e922--- /dev/null+++ b/skills/godot/godot-gdscript/SKILL.md@@ -0,0 +1,136 @@+---+name: godot-gdscript+description: >+ Write idiomatic GDScript for Godot 4.x: 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 (func signatures, yield -> await, export -> @export).+license: Apache-2.0+compatibility: Godot 4.3+ (GDScript 2.0)+metadata:+ engine: godot+ category: godot+ difficulty: beginner+---++# 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.3+** (GDScript 2.0).++## When to use++- Use when writing or fixing `.gd` files: 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++1. **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.+2. **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).+3. **Grab node references with `@onready`**, not in `_init()` — children do not exist+ until the node enters the tree.+4. **Expose tunables with `@export`** so designers edit them in the Inspector.+5. **React to events with signals + `await`**, not polling, where it reads cleanly.+6. **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++```gdscript+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)++```gdscript+extends Node++signal health_changed(current: int, maximum: int) # typed signal params++var health := 100++func take_damage(amount: int) -> void:+ health = max(health - amount, 0)+ 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)++```gdscript+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++```gdscript+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 prefer+ `x.emit(...)`; `connect("x", self, "_on_x")` is gone — use `x.connect(_on_x)` with a+ Callable. `yield(obj, "sig")` is now `await obj.sig`.+- **`export var` is now `@export var`** (annotation). Likewise `onready`→`@onready`,+ `tool`→`@tool`, `remote`/`master` RPC keywords → the `@rpc(...)` annotation.+- **`@onready` and `$NodePath` in `_init()` fail** — the node isn't in the tree yet.+ Initialize node references in `_ready()` or with `@onready`.+- **Integer division truncates.** `5 / 2 == 2`. Use `5.0 / 2` or cast to `float`.+- **`_process` vs `_physics_process`.** Put `move_and_slide()` and physics in+ `_physics_process(delta)`; using `_process` makes motion frame-rate dependent.+- **`class_name` must be unique** project-wide and is required to use the type name in+ other scripts or as an Inspector type.++## References++- For the full annotation list, advanced typing, and style conventions, read+ `references/annotations-and-typing.md`.++## Related skills++- `godot-nodes-scenes` — the scene tree, instancing, and autoloads.+- `godot-signals-groups` — event-driven architecture with signals and groups.+- `godot-resources` — data-driven design with custom `Resource` types.+- `godot-csharp` — the same engine concepts using C#/.NET.diff --git a/skills/godot/godot-gdscript/references/annotations-and-typing.md b/skills/godot/godot-gdscript/references/annotations-and-typing.mdnew file mode 100644index 0000000..5a96cf1--- /dev/null+++ b/skills/godot/godot-gdscript/references/annotations-and-typing.md@@ -0,0 +1,77 @@+# GDScript annotations & typing reference (Godot 4.3+)++Depth companion to `godot-gdscript`. All annotations start with `@` in GDScript 2.0.++## Common export annotations++```gdscript+@export var title: String = "Level 1"+@export var enabled := true+@export_range(0, 100, 1) var percent: int = 50 # min, max, step+@export_range(0.0, 1.0, 0.01, "or_greater") var gain := 1.0+@export_enum("Idle", "Walk", "Run") var state: int # int-backed dropdown+@export_enum("Sword", "Bow") var weapon: String # string-backed dropdown+@export_flags("Fire", "Water", "Earth") var resist: int # bitmask+@export_file("*.json") var data_path: String # file picker+@export_dir var folder: String+@export_multiline var description: String # multi-line text box+@export_color_no_alpha var tint: Color+@export_node_path("Camera2D") var cam_path: NodePath+@export_group("Movement") # groups Inspector fields+@export var speed := 200.0+@export_subgroup("Air")+@export var air_control := 0.4+```++Export a typed array of resources (great for data-driven design):++```gdscript+@export var waves: Array[PackedScene] = []+@export var loot: Array[ItemResource] = []+```++## Other annotations++- `@onready var x = $Child` — assign when the node enters the tree.+- `@tool` — run the script in the editor (top of file). Guard editor-only code with+ `if Engine.is_editor_hint():`.+- `@icon("res://icon.svg")` — custom Inspector icon for a `class_name` type.+- `@rpc("any_peer", "call_local", "reliable")` — mark a networked method (see+ `godot-multiplayer`).+- `@warning_ignore("unused_variable")` — silence a specific parser warning.+- `@static_unload` — allow a script's static variables to unload.++## Static typing details++```gdscript+var a: int = 3 # explicit type+var b := 3 # inferred int via :=+var c: float # typed, defaults to 0.0+var nodes: Array[Node2D] = [] # typed array (element type enforced)+var scores: Dictionary = {} # Dictionary is untyped in 4.3; typed dicts arrived in 4.4++func clamp_hp(hp: int) -> int:+ return clampi(hp, 0, 100) # clampi/clampf are typed variants+```++Typed code is faster because the VM can skip runtime type checks, and the editor can+autocomplete and flag mismatches before you run.++## Lifecycle callbacks (order)++1. `_init()` — object constructed (no tree, no children resolved).+2. `_enter_tree()` — node added to the tree (children may not be ready).+3. `_ready()` — node and all children are in the tree (runs once). `@onready` vars are+ assigned just before this.+4. `_process(delta)` — every rendered frame (skip with `set_process(false)`).+5. `_physics_process(delta)` — every fixed physics tick (default 60 Hz).+6. `_exit_tree()` — node removed from the tree.+7. `_notification(what)` — low-level catch-all (e.g. `NOTIFICATION_WM_CLOSE_REQUEST`).++## Idioms++- Prefer `is_instance_valid(node)` before touching a node that may have been freed.+- Use `queue_free()` (deferred) over `free()` to delete a node safely during a frame.+- `match` is GDScript's switch: supports values, arrays `[1, var x]`, and `_` default.+- String formatting: `"%s scored %d" % [name, score]`.+- Use `assert(cond, "msg")` for debug-only invariants (stripped in release builds).diff --git a/skills/godot/godot-nodes-scenes/SKILL.md b/skills/godot/godot-nodes-scenes/SKILL.mdnew file mode 100644index 0000000..d185601--- /dev/null+++ b/skills/godot/godot-nodes-scenes/SKILL.md@@ -0,0 +1,125 @@+---+name: godot-nodes-scenes+description: >+ Structure a Godot 4.x project with the scene tree and node composition: build+ reusable scenes, instance PackedScenes at runtime, navigate the tree safely,+ and register autoload singletons. Use when designing .tscn scenes, deciding how+ to split nodes, spawning instances with instantiate(), wiring autoloads, or+ fixing "node not found"/freed-node errors in a Godot project.+license: Apache-2.0+compatibility: Godot 4.3++metadata:+ engine: godot+ category: godot+ difficulty: beginner+---++# Godot Nodes & Scenes (4.x)++Compose games from nodes and scenes, instance them at runtime, and access the tree+without crashing on freed or missing nodes. Targets **Godot 4.3+**.++## When to use++- Use when structuring `.tscn` scenes, choosing how to break a feature into nodes,+ instancing a `PackedScene` (bullets, enemies, UI), or setting up autoload singletons.+- Use when debugging `get_node()` / `$Path` returning `null`, or "Attempt to call on a+ previously freed instance".++**When *not* to use:** GDScript language/syntax → `godot-gdscript`; signal-based+decoupling → `godot-signals-groups`; physics bodies/collisions → `godot-physics`.++## Core workflow++1. **Model with composition.** A scene is a tree of nodes saved as `.tscn`. Build small,+ single-purpose scenes (Player, Bullet, Enemy) and compose larger scenes from them.+ Favor adding child nodes over deep inheritance.+2. **Make a scene reusable** by giving its root a script and exposing `@export` config.+ Save it; it becomes a `PackedScene` you can instance many times.+3. **Instance at runtime** with `preload`/`load` → `scene.instantiate()` →+ `add_child(instance)`. Set position/state *after* adding (or before, both work).+4. **Access nodes safely.** Use `@onready var x = $Path` for fixed children; use unique+ names (`%Name`) for nodes deep in the tree; never assume a node still exists.+5. **Use autoloads for global state/services** (game state, audio, scene switching) —+ registered in Project Settings > Globals (Autoload), accessible by name everywhere.+6. **Free nodes with `queue_free()`** and guard later access with `is_instance_valid()`.++## Patterns++### 1. Instance a scene at runtime++```gdscript+extends Node2D++const BULLET := preload("res://bullet.tscn") # preload: loaded at compile time++func shoot(at: Vector2, dir: Vector2) -> void:+ var bullet := BULLET.instantiate() # create an instance of the scene+ bullet.global_position = at+ bullet.direction = dir # set exported/public state+ add_child(bullet) # now it's in the tree and runs+```++### 2. Safe node access: $, get_node_or_null, and unique names++```gdscript+@onready var label: Label = $UI/Label # $ is sugar for get_node("UI/Label")+@onready var health_bar: ProgressBar = %HealthBar # % = scene-unique name (rename-proof)++func update() -> void:+ var optional := get_node_or_null("Maybe/Missing") # returns null instead of erroring+ if optional:+ optional.queue_free()+```++### 3. An autoload singleton (global game state)++```gdscript+# game_state.gd — add in Project Settings > Globals > Autoload as "GameState".+extends Node++var score := 0+signal score_changed(value: int)++func add_score(points: int) -> void:+ score += points+ score_changed.emit(score) # any scene can: GameState.score_changed.connect(...)+```++### 4. Change the running scene++```gdscript+func go_to_level_2() -> void:+ # Swaps the current scene for another. Frees the old scene tree.+ get_tree().change_scene_to_file("res://levels/level_2.tscn")+ # Or, with a preloaded PackedScene:+ # get_tree().change_scene_to_packed(LEVEL_2)+```++## Pitfalls++- **`$Path` / `get_node()` return `null` or error** when the path is wrong or the node+ isn't in the tree yet. Use `@onready`, verify the path matches the scene, or use+ `get_node_or_null()` for optional nodes.+- **Renaming a node breaks `$Path`.** Use **unique names** (`%Name`, set via right-click+ > Access as Unique Name) so deep references survive renames and reparenting.+- **`free()` mid-frame can crash** other code still using the node. Prefer+ `queue_free()` (deletes at end of frame) and check `is_instance_valid(node)`.+- **Setting child state before `add_child()`** is fine, but `_ready()` on the child only+ runs *after* it enters the tree — don't expect its `@onready` vars before that.+- **Autoload order matters**: autoloads are added before the main scene, in list order.+ An autoload can't depend on the main scene existing yet.+- **`instance()` was renamed** to `instantiate()` in Godot 4. `preload` runs at parse+ time (path must be constant); `load` runs at runtime (path can be a variable).++## References++- For scene inheritance, `owner`/ownership when saving scenes from code, groups vs+ unique names, and node-path edge cases, read `references/tree-and-instancing.md`.++## Related skills++- `godot-gdscript` — language, lifecycle, and `@onready`.+- `godot-signals-groups` — decouple instanced scenes from their spawner.+- `godot-resources` — share data between instances without duplicating it.+- `save-systems` — persist scene/game state across runs.diff --git a/skills/godot/godot-nodes-scenes/references/tree-and-instancing.md b/skills/godot/godot-nodes-scenes/references/tree-and-instancing.mdnew file mode 100644index 0000000..7729e3b--- /dev/null+++ b/skills/godot/godot-nodes-scenes/references/tree-and-instancing.md@@ -0,0 +1,79 @@+# Scene tree & instancing reference (Godot 4.3+)++Depth companion to `godot-nodes-scenes`.++## Node paths++- `$Child`, `$Child/Grandchild` — relative path sugar for `get_node(...)`.+- `$"Node With Spaces"` — quote paths containing spaces or starting with a number.+- `%UniqueName` — a scene-unique node. Mark a node "Access as Unique Name" in the editor;+ the reference then works no matter where the node sits in that scene's subtree.+- `get_node("../Sibling")` — `..` walks up to the parent.+- `get_tree().root` — the `Window` at the very top; the current scene is+ `get_tree().current_scene`.++## Loading and instancing++```gdscript+const SCENE := preload("res://enemy.tscn") # constant path, loaded with the script+var dynamic := load(path_variable) # runtime path, may be a variable++var e := SCENE.instantiate() # PackedScene -> Node+add_child(e) # enters tree, _ready() fires+# To instance with the editor state of exported sub-resources, instantiate() is enough.+```++`instantiate()` flags: `PackedScene.GEN_EDIT_STATE_DISABLED` (default, runtime) vs+`GEN_EDIT_STATE_INSTANCE`/`GEN_EDIT_STATE_MAIN` (editor tooling only).++## Ownership when saving scenes from code++To build a scene in code and save it, every node you want serialized must have its+`owner` set to the scene root:++```gdscript+func save_built_scene() -> void:+ var root := Node2D.new()+ var child := Sprite2D.new()+ root.add_child(child)+ child.owner = root # without this, child is NOT saved+ var packed := PackedScene.new()+ packed.pack(root)+ ResourceSaver.save(packed, "res://generated.tscn")+```++## Scene inheritance++In the editor, "New Inherited Scene" from a base `.tscn` creates a child scene that+inherits the base's nodes and can override properties or add nodes. Useful for variant+enemies sharing a common base. Changes to the base propagate to inherited scenes.++## Groups vs unique names vs autoloads++- **Unique name (`%`)** — reference a specific node *within the same scene*.+- **Group** — tag many nodes and act on all of them; see `godot-signals-groups`.+- **Autoload** — one global instance accessible by name across all scenes; use for+ services and cross-scene state, not for per-level nodes.++## Freeing and validity++```gdscript+node.queue_free() # safe: deletes at end of current frame+if is_instance_valid(node): # guard against use-after-free+ node.do_something()+node.free() # immediate; only when you control the timing+```++`get_child_count()`, `get_children()`, `move_child(node, idx)`, and+`reparent(new_parent)` (4.x) manage tree structure at runtime. `reparent` keeps global+transform by default.++## Deferred calls++When adding/removing nodes during physics callbacks or signal handlers, defer to avoid+"flushing queries" errors:++```gdscript+add_child.call_deferred(instance)+node.queue_free() # already deferred+```diff --git a/skills/godot/godot-signals-groups/SKILL.md b/skills/godot/godot-signals-groups/SKILL.mdnew file mode 100644index 0000000..e17658f--- /dev/null+++ b/skills/godot/godot-signals-groups/SKILL.md@@ -0,0 +1,137 @@+---+name: godot-signals-groups+description: >+ Build event-driven, decoupled Godot 4.x gameplay with signals and node groups:+ declare and emit custom signals, connect with Callables (incl. bind/one-shot),+ and broadcast to many nodes via groups and call_group. Use when wiring node+ communication in a Godot project, replacing tight references with signals,+ emitting/connecting events, or porting 3.x connect("sig", self, "method") code.+license: Apache-2.0+compatibility: Godot 4.3++metadata:+ engine: godot+ category: godot+ difficulty: beginner+---++# Godot Signals & Groups (4.x)++Decouple nodes with the observer pattern (signals) and act on many nodes at once+(groups), instead of hard-coding references between scenes. Targets **Godot 4.3+**.++## When to use++- Use when a node needs to tell others "something happened" (player died, item picked+ up, wave cleared) without holding direct references to them.+- Use when you need to address a whole category of nodes at once ("pause all enemies",+ "save every checkpoint").++**When *not* to use:** raw signal *syntax* basics → `godot-gdscript`; scene structure+and instancing → `godot-nodes-scenes`. For cross-scene global events, emit from an+autoload (see `godot-nodes-scenes`).++## Core workflow++1. **Decide the direction.** A child/sub-scene should *emit* a signal upward; the parent+ *connects* to it. This keeps the child reusable and ignorant of who listens.+2. **Declare typed signals** on the emitter; `emit()` them when the event occurs.+3. **Connect with a Callable** (`sig.connect(_on_sig)`), optionally in the editor's Node+ dock. Use `CONNECT_ONE_SHOT` for fire-once, `bind()` to pass extra context.+4. **Use groups for broadcast**: add nodes to a named group, then iterate+ `get_tree().get_nodes_in_group(...)` or `call_group(...)`.+5. **Disconnect when needed** (e.g. before freeing a long-lived listener) and check+ `is_connected()` to avoid duplicate connections.++## Patterns++### 1. Emit upward, connect from the parent++```gdscript+# coin.gd (reusable pickup — knows nothing about the player or HUD)+extends Area2D+signal collected(value: int)++func _on_body_entered(body: Node) -> void:+ if body.is_in_group("player"):+ collected.emit(10)+ queue_free()+```++```gdscript+# level.gd (the parent wires the coin to game state)+func _ready() -> void:+ for coin in get_tree().get_nodes_in_group("coins"):+ coin.collected.connect(_on_coin_collected)++func _on_coin_collected(value: int) -> void:+ GameState.add_score(value)+```++### 2. Connect flags: one-shot and bind extra arguments++```gdscript+func _ready() -> void:+ # Fire exactly once, then auto-disconnect.+ $Door.opened.connect(_on_door_opened, CONNECT_ONE_SHOT)+ # bind() appends arguments supplied at connect time (after the signal's own args).+ $RedButton.pressed.connect(_on_button.bind("red"))++func _on_button(color: String) -> void:+ print("Pressed the %s button" % color)+```++### 3. Groups: broadcast to many nodes++```gdscript+func pause_all_enemies() -> void:+ # Call a method on every node in the "enemies" group (no-op if missing).+ get_tree().call_group("enemies", "set_paused", true)++func count_enemies() -> int:+ return get_tree().get_nodes_in_group("enemies").size()+```++Add a node to a group from code or via the editor's Node > Groups tab:++```gdscript+func _ready() -> void:+ add_to_group("enemies") # remove_from_group("enemies") to leave+```++### 4. Await a signal inline++```gdscript+func open_chest() -> void:+ $AnimationPlayer.play("open")+ await $AnimationPlayer.animation_finished # pause until it emits+ spawn_loot()+```++## Pitfalls++- **3.x connect signature is gone.** `connect("died", self, "_on_died")` →+ `died.connect(_on_died)`. The target is implied by the Callable. The legacy+ `Object.connect("died", Callable(self, "_on_died"))` works but the method-name string+ form does not.+- **Duplicate connections fire handlers multiple times.** Connecting again in `_ready()`+ after re-adding a node stacks callbacks. Guard with+ `if not sig.is_connected(cb): sig.connect(cb)`.+- **Connecting to a freed node errors.** Disconnect long-lived listeners, or rely on+ Godot auto-disconnecting when the *connected object* is freed (it does for nodes).+- **Groups are global to the SceneTree**, not per-scene. Two levels using the same group+ name share membership. Namespace group names if that matters.+- **`call_group` silently ignores nodes lacking the method.** Typos in the method name+ fail quietly — prefer a typed signal when the contract matters.+- **Signal args must match.** Emitting with the wrong arg count/types raises an error;+ declare typed params and emit exactly those.++## References++- For connection flags, deferred connections, custom signal arguments, awaiting with+ timeouts, and signals vs. direct calls trade-offs, read `references/signal-patterns.md`.++## Related skills++- `godot-gdscript` — signal/`await` syntax fundamentals.+- `godot-nodes-scenes` — autoloads for global event buses.+- `game-ai` — state machines that often drive and consume these events.diff --git a/skills/godot/godot-signals-groups/references/signal-patterns.md b/skills/godot/godot-signals-groups/references/signal-patterns.mdnew file mode 100644index 0000000..dd8621a--- /dev/null+++ b/skills/godot/godot-signals-groups/references/signal-patterns.md@@ -0,0 +1,98 @@+# Signal & group patterns reference (Godot 4.3+)++Depth companion to `godot-signals-groups`.++## Connection flags++`Object.connect` / `Signal.connect` accept a flags bitmask:++- `CONNECT_ONE_SHOT` — disconnect automatically after the first emission.+- `CONNECT_DEFERRED` — invoke the callback at idle time (end of frame) instead of+ immediately. Useful when the handler modifies the tree during physics.+- `CONNECT_PERSIST` — the connection is saved with the scene (editor-made connections).+- `CONNECT_REFERENCE_COUNTED` — multiple identical connections are reference-counted so+ the matching number of disconnects is required.++```gdscript+sig.connect(cb, CONNECT_ONE_SHOT | CONNECT_DEFERRED)+```++## bind vs unbind++- `cb.bind(a, b)` — appends `a, b` to the end of the argument list when called.+- `cb.unbind(n)` — drops the last `n` signal arguments. Handy when the handler ignores+ the signal's payload: `sig.connect(_refresh.unbind(sig_arg_count))`.++## Custom signals with typed arguments++```gdscript+signal stat_changed(stat_name: String, old_value: int, new_value: int)++func set_stat(stat: String, value: int) -> void:+ var old := stats.get(stat, 0)+ stats[stat] = value+ stat_changed.emit(stat, old, value)+```++Typed parameters are documentation and let the editor's connection dialog show argument+names. They are not strictly enforced at runtime but emitting the wrong count errors.++## Awaiting a signal with a timeout++`await` has no built-in timeout. Race the signal against a timer:++```gdscript+func wait_for_signal_or_timeout(obj: Object, sig: String, seconds: float) -> bool:+ var timer := get_tree().create_timer(seconds)+ # Whichever emits first resumes; check which one.+ var got = await Signal(obj, sig) # for a fixed signal, prefer obj.signal_name+ return true+```++For most gameplay, awaiting `animation_finished`, `timeout`, or `tween_finished`+directly is cleaner.++## Disconnecting safely++```gdscript+if sig.is_connected(cb):+ sig.disconnect(cb)+```++Nodes auto-disconnect connections where the *connected object* (the one owning the+Callable) is freed. You still must disconnect manually if the *emitter* outlives the+listener and you re-create listeners (otherwise stale connections accumulate).++## Groups: full API++```gdscript+add_to_group("saveable") # optional 2nd arg: persistent+remove_from_group("saveable")+is_in_group("saveable")+get_tree().get_nodes_in_group("saveable") # Array[Node]+get_tree().get_first_node_in_group("player") # first match or null+get_tree().call_group("enemies", "method", arg)+get_tree().set_group("enemies", "modulate", Color.RED) # set a property on all+```++`call_group` has flag variants (`call_group_flags`) for deferred/unique-only calls.++## Signals vs direct calls — when to use which++- **Signal** when the emitter should not know or care who listens (reusable scenes,+ one-to-many, decoupling UI from logic).+- **Direct call** when there is a clear owner→owned relationship and coupling is fine+ (a controller calling a method on a component it created). Over-using signals for+ tightly coupled code adds indirection without benefit.++## Global event bus (autoload)++For events that cross scenes, declare signals on an autoload and have any scene emit or+connect:++```gdscript+# Events.gd (autoload). Emit: Events.player_died.emit(). Listen: Events.player_died.connect(...)+extends Node+signal player_died+signal level_completed(level_id: int)+```