[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6GV8MF5MV9RC8SN4JY9GZCS":3,"skill-same:01M6GV8MF5MV9RC8SN4JY9GZCS":69},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":28,"publishedAt":42,"linkOnly":43,"markdownContent":44,"markdownBody":45,"frontMatter":46,"refName":47,"commitSha":48,"skillDirectory":49,"forksCount":50,"repositoryHtmlUrl":51,"repositoryHomepageUrl":6,"ownerHtmlUrl":52,"ownerBlogUrl":53,"ownerDescription":6,"updatedAt":54,"install":55,"resources":68},"01M6GV8MF5MV9RC8SN4JY9GZCS","godot-gdscript",null,"GDScript 4.x syntax reference — types, operators, classes, signals, patterns, and common API. Load when writing or reviewing GDScript code.","dragoscirjan\u002Fopencode-config","dragoscirjan","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F950596?v=4","01M6GV509X835Z595VVKDX1HFY","Dragos Cirjan","01M6GV50XSMSSD7W2M2KJXTQN6",1,"MIT","https:\u002F\u002Fgithub.com\u002Fdragoscirjan\u002Fopencode-config\u002Fblob\u002Fmain\u002Fskills\u002Fgodot-gdscript\u002FSKILL.md",[18,23],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":26,"taxonomyTypeDesc":27},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[29,30,31,32,33,34,35,36,37,38,39,40,41],"godot","godot gdscript","writing","code","api","common","syntax","reference","patterns","signals","operators","types","load","2026-11-10 10:12:30",false,"---\nname: godot-gdscript\ndescription: GDScript 4.x syntax reference — types, operators, classes, signals, patterns, and common API. Load when writing or reviewing GDScript code.\n---\n\n# GDScript Syntax Reference\n\n## Language Notes\n\n- Indentation-based; a script file defines a class.\n- GDScript is its own language (not Python).\n\n## Identifiers\n\n- Letters\u002Fdigits\u002F\\_; cannot start with a digit; case-sensitive.\n- Unicode letters per UAX#31 are allowed; no emoji or confusable characters.\n\n## Types\n\n**Basic:** `null`, `bool`, `int`, `float`, `String`, `StringName`, `NodePath`\n\n**Vector:** `Vector2`, `Vector2i`, `Vector3`, `Vector3i`, `Vector4`, `Vector4i`\n\n**Transform:** `Transform2D`, `Transform3D`, `Basis`, `Quaternion`\n\n**Geometry:** `Rect2`, `Rect2i`, `AABB`, `Plane`\n\n**Other:** `Color`, `RID`, `Object`, `Callable`, `Signal`\n\n**Containers:** `Array`, `Array[Type]`, `Dictionary`, `Dictionary[K, V]`\n\n**Packed:** `PackedByteArray`, `PackedInt32Array`, `PackedInt64Array`, `PackedFloat32Array`,\n`PackedFloat64Array`, `PackedStringArray`, `PackedVector2Array`, `PackedVector3Array`,\n`PackedVector4Array`, `PackedColorArray`\n\n**Variant:** Means untyped; not a real type for inference by default.\n\n**Value vs reference:** Built-in types (`bool`, `int`, `float`, `Vector2\u002F3`, `AABB`, `Transform2D\u002F3D`, `Color`, `Rect2`, etc.) are value types — passing them to a function creates a copy, assignments inside the function do NOT update the caller. `Object`, `Array`, `Dictionary`, and packed arrays are reference types (use `duplicate()` to copy).\n\n## Keywords\n\n```\nif elif else match when for while break continue pass return\nclass class_name extends is in as not and or\nfunc signal var const enum static\nself super await preload yield breakpoint assert\ntrue false null void\nPI TAU INF NAN\n```\n\n## Operators (by precedence)\n\n```\n()                           # Grouping\nx.attr  x[\"key\"]  x()        # Attribute, subscript, call\nawait x                      # Await\n**                           # Power\n~ + -                        # Unary (bitwise NOT, positive, negative)\n* \u002F %                        # Multiply, divide, modulo\n+ -                          # Add, subtract\n\u003C\u003C >>                        # Bit shift\n&                            # Bitwise AND\n^                            # Bitwise XOR\n|                            # Bitwise OR\n\u003C > \u003C= >= == !=              # Comparison\nin  not in  is  is not       # Containment, type check\nnot  !                       # Boolean NOT (alias)\nand  &&                      # Boolean AND (alias)\nor   ||                      # Boolean OR (alias)\nx if cond else y             # Ternary\nas                           # Type cast\n= += -= *= \u002F= **= etc.       # Assignment\n```\n\nOperator notes:\n\n- `**` is left-associative; ternary is right-associative.\n- `\u002F` does integer division when both operands are `int`.\n- `%` only works on `int`; use `fmod()` for floats. Use `posmod()`\u002F`fposmod()` for math-style remainders.\n- Assignment is not allowed inside expressions.\n- `==`\u002F`!=` can compare different types but may cause runtime errors. Use `is_same()` for strict comparison, `is_equal_approx()` for floats.\n\n## Literals\n\n```\nnull, true, false\n45, 0x8f51, 0b101010, 3.14, 1_000_000, 3.14_159\n\"Hello\", 'Hi', \"\"\"Multi\"\"\", r\"Raw\", r'''Raw'''\n&\"name\"       # StringName\n^\"Node\u002FPath\"  # NodePath\n$NodePath     # get_node(\"NodePath\")\n%UniqueNode   # get_node(\"%UniqueNode\")\n```\n\nCommon escapes: `\\n \\t \\r \\a \\b \\f \\v \\\\ \\\" \\' \\uXXXX \\UXXXXXX`.\nRaw strings do not process escapes and cannot end with an odd number of `\\`.\n\n## Variables & Constants\n\n```gdscript\nvar x = 5                    # Variant (no type)\nvar y: int = 5               # Explicit type\nvar z := 5                   # Inferred with := (literal has clear type)\nconst MAX := 100             # Constant\nstatic var count := 0        # Class-level static\n\n# Type inference only works when the RHS has a concrete type.\n# Variant-returning functions or data access break := inference.\nvar bad := abs(speed)                   # ERROR: Cannot infer type from Variant\nvar bad2 := clamp(val, 0.0, 1.0)        # ERROR: Same problem\nvar bad3 := min(a, b)                   # ERROR: Same problem\nvar good: float = abs(speed)            # OK: explicit type annotation\nvar also_ok = abs(speed)                # OK: untyped (Variant)\n\nenum State { IDLE, RUN, JUMP }\nenum { ONE = 1, TWO, THREE }\n\n# Named enums are dictionaries with extra methods\nState.IDLE               # 0\nState.keys()             # [\"IDLE\", \"RUN\", \"JUMP\"]\nState.values()           # [0, 1, 2]\n```\n\nInitialization order (members):\n\n- Default value by type (or `null` for untyped\u002FObjects).\n- Declaration order initializers.\n- `_init()`.\n- Exported values (scenes\u002Fresources).\n- `@onready` values.\n- `_ready()`.\n\n## Functions\n\n```gdscript\nfunc add(a: int, b: int) -> int:\n    return a + b\n\nfunc greet(name := \"World\") -> void:  # Default parameter\n    print(\"Hello, \", name)\n\nfunc process(items: Array[String]) -> void:  # Typed array\n    for item in items:\n        print(item)\n\n# Lambda (explicit return required)\nvar double := func(x): return x * 2\n\n# Lambda capture behavior:\n# - Primitives captured by value at creation time (won't see later changes)\n# - Arrays\u002Fdicts\u002Fobjects captured by reference (content changes shared)\n# - Cannot reassign outer variables (CONFUSABLE_CAPTURE_REASSIGNMENT warning)\nvar x = 42\nvar arr = []\nvar fn = func():\n    print(x)       # Always 42, even if x changed after lambda creation\n    arr.append(1)  # Shared with outer scope\n    x = 99         # Warning: only affects lambda's copy\n\n# Static function\nstatic func create() -> MyClass:\n    return MyClass.new()\n\n# Function reference (Callable)\nvar callback = my_function  # Gets Callable without calling\ncallback.call(arg1, arg2)   # Must use .call() to invoke\n\n# Static constructor (called on load)\nstatic func _static_init() -> void:\n    pass\n\n# Variadic (rest parameter; must be last, no default)\nfunc sum(...values: Array) -> int:\n    var total := 0\n    for n in values:\n        total += n\n    return total\n```\n\nVariadic notes:\n\n- Only one rest parameter, and it must be last.\n- Rest parameter cannot be `Array[Type]` (use `Array`).\n- You cannot unpack\u002Frest-spread arguments on call sites (use `callv`).\n\n## Control Flow\n\n```gdscript\n# Conditionals\nif condition:\n    pass\nelif other:\n    pass\nelse:\n    pass\n\n# Ternary\nvar result = \"yes\" if condition else \"no\"\n\n# Match (pattern matching)\nmatch value:\n    1:\n        print(\"one\")\n    2, 3, 4:\n        print(\"two to four\")\n    [var a, var b]:\n        print(a, b)\n    {\"key\": var v}:\n        print(v)\n    var x when x > 10:       # Guard clause\n        print(\"big: \", x)\n    _:\n        print(\"default\")\n\n# Loops\nfor i in range(10):          # 0 to 9\n    if i == 5:\n        continue             # Skip iteration\n    if i == 8:\n        break                # Exit loop\nfor item in array:\n    pass\nfor name: String in names:   # Typed loop variable\n    print(name.to_upper())\nfor key in dict:\n    var val = dict[key]\nwhile condition:\n    pass\n```\n\n## Classes\n\n```gdscript\nclass_name MyClass\nextends Node2D\n\n# Abstract class\u002Fmethod (cannot be instantiated or attached to nodes)\n@abstract class Shape:\n    @abstract func draw() -> void  # No body; subclasses must implement\n\nsignal health_changed(new_value: int)\nsignal died\n\n@export var speed: float = 100.0\n@export_range(0, 100) var health: int = 100\n@onready var sprite: Sprite2D = $Sprite2D\n\nvar _private := 0\n\n# Property with getter\u002Fsetter\nvar score: int:\n    get:\n        return score       # Direct access inside own getter (no recursion)\n    set(value):\n        score = clamp(value, 0, 100)  # Direct access inside own setter\n        score_changed.emit(score)\n\n# Alternative property syntax (reusing functions)\nvar my_prop: get = _get_prop, set = _set_prop\n\n# Setter\u002Fgetter NOT called: during initialization and inside own accessor\nvar x: int = 5  # Setter not called here\n\nfunc _init() -> void:\n    pass\n\nfunc _ready() -> void:\n    super._ready()  # Call parent\n    # self.prop is runtime-checked (works for dynamic\u002Fchild properties)\n    # prop alone is compile-time checked (must exist in current class)\n\nfunc something(p1, p2) -> void:\n    super(p1, p2)   # Call overridden method by name\n\nfunc _process(delta: float) -> void:\n    pass\n\n# Inner class\nclass InnerEnemy:\n    var hp := 100\n    func take_damage(amount: int) -> void:\n        hp -= amount\n```\n\n## Node References\n\n```gdscript\n$NodeName                    # Get child node\n$Path\u002FTo\u002FNode                # Nested path\n%UniqueNode                  # Scene-unique node (set in editor)\nget_node(\"Path\")             # Equivalent to $\nget_parent()                 # Parent node\nget_tree()                   # SceneTree\nget_node_or_null(\"Path\")     # Returns null if not found\nhas_node(\"Path\")             # Check existence\n```\n\n## Signals\n\n```gdscript\n# Define\nsignal my_signal\nsignal value_changed(new_val: int)\n\n# Emit\nmy_signal.emit()\nvalue_changed.emit(42)\n\n# Connect\nother_node.my_signal.connect(_on_signal)\nother_node.my_signal.connect(func(): print(\"lambda\"))\n\n# Connect with bound arguments\nother_node.my_signal.connect(_on_signal.bind(\"extra_data\"))\n\n# Disconnect\nother_node.my_signal.disconnect(_on_signal)\n\n# Await\nawait my_signal\nawait get_tree().create_timer(1.0).timeout\nvar result = await some_async_func()\n```\n\n## Annotations\n\n```gdscript\n@export var visible_in_editor: int\n@export_range(0, 100, 1) var clamped: int\n@export_enum(\"Low\", \"Medium\", \"High\") var quality: int\n@export_file(\"*.png\") var texture_path: String\n@export_node_path(\"Sprite2D\") var sprite_path: NodePath\n@export_group(\"Movement\")    # Group following exports\n@export_subgroup(\"Speed\")    # Subgroup\n\n@onready var node := $Child  # Resolved when _ready() runs\n\n@tool  # Script runs in editor (be careful with queue_free!)\n@static_unload # Unload script when no references (for static vars)\n@warning_ignore(\"unused_parameter\")\n\n@icon(\"res:\u002F\u002Ficon.png\")  # Custom class icon\n```\n\nAnnotations:\n\n- Multiple annotations can be stacked; they apply to the next non-annotation line.\n- `@onready` with `@export` is not recommended; `@onready` overwrites exported values\n  and triggers the `ONREADY_WITH_EXPORT` warning.\n\n## Comments & Regions\n\n```gdscript\n# Line comment\n## Documentation comment (for script docs\u002Finspector tooltips)\n\n#region Terrain\nfunc generate_lakes():\n    pass\n#endregion\n```\n\nEditor highlights markers (case-sensitive):\n\n- Critical (red): `ALERT`, `ATTENTION`, `CAUTION`, `CRITICAL`, `DANGER`, `SECURITY`\n- Warning (yellow): `BUG`, `DEPRECATED`, `FIXME`, `HACK`, `TASK`, `TODO`, `WARNING`\n- Notice (green): `INFO`, `NOTE`, `NOTICE`, `TEST`\n\n## Line Continuation\n\n```gdscript\nvar a = 1 + \\\n2 + \\\n3\n```\n\n## Strings\n\n```gdscript\n# Regular strings\nvar s = \"Hello\\nWorld\"       # With escape sequences\nvar raw = r\"C:\\path\\file\"    # Raw string (no escapes)\nvar multi = \"\"\"\nLine 1\nLine 2\n\"\"\"                          # Triple-quoted multiline\n\n# Special literals\nvar sname: StringName = &\"my_action\"  # StringName (interned)\nvar npath: NodePath = ^\"Path\u002FTo\u002FNode\" # NodePath literal\n\n# Format strings\n\"Hello %s\" % name            # Single value\n\"x=%d y=%d\" % [x, y]         # Multiple values\n\"%.2f\" % 3.14159             # Float precision\n\n# Common methods\ns.length()                   # String length\ns.to_upper()                 # HELLO\ns.to_lower()                 # hello\ns.strip_edges()              # Trim whitespace\ns.split(\",\")                 # Split to array\n\",\".join([\"a\", \"b\"])         # Join array\ns.begins_with(\"He\")          # Prefix check\ns.ends_with(\"ld\")            # Suffix check\ns.find(\"ll\")                 # Find substring index\ns.replace(\"l\", \"L\")          # Replace\nstr(42)                      # Convert to string\nint(\"42\")                    # Parse int\nfloat(\"3.14\")                # Parse float\n```\n\n## Arrays & Dictionaries\n\n```gdscript\n# Arrays\nvar arr := [1, 2, 3]\nvar typed: Array[int] = [1, 2, 3]\n\n# Cannot assign Array[SubType] to Array[BaseType] directly\nvar nodes2d: Array[Node2D] = [Node2D.new()]\nvar nodes: Array[Node] = []\n# nodes = nodes2d  # ERROR: incompatible types\nnodes.assign(nodes2d)  # OK: copies contents\narr.append(4)                # Add to end\narr.push_front(0)            # Add to start\narr.insert(2, 99)            # Insert at index\narr.pop_back()               # Remove and return last\narr.pop_front()              # Remove and return first\narr.remove_at(1)             # Remove at index\narr.erase(2)                 # Remove first occurrence of value\narr.size()                   # Length\narr.is_empty()               # Check empty\narr.has(2)                   # Check contains\narr.find(2)                  # Find index (-1 if not found)\narr.sort()                   # Sort in place\narr.reverse()                # Reverse in place\narr.duplicate()              # Shallow copy\narr.shuffle()                # Randomize order\narr.slice(1, 3)              # Subarray [1:3)\narr.map(func(x): return x*2) # Transform\narr.filter(func(x): return x > 0)  # Filter\narr.reduce(func(a, b): return a + b, 0)  # Reduce\n\n# Dictionaries\nvar dict := {\"key\": \"value\", \"num\": 42}\nvar typed: Dictionary[String, int] = {\"a\": 1}\ndict[\"new_key\"] = 100        # Add\u002Fupdate\ndict.get(\"key\", \"default\")   # Get with default\ndict.has(\"key\")              # Check key exists\ndict.erase(\"key\")            # Remove key\ndict.keys()                  # Array of keys\ndict.values()                # Array of values\ndict.size()                  # Number of entries\ndict.is_empty()              # Check empty\ndict.merge(other_dict)       # Merge in place\n```\n\nArray\u002Fdict notes:\n\n- `Array` == `Array[Variant]`. `Dictionary` == `Dictionary[Variant, Variant]`.\n- Dictionary\u002Farray access returns `Variant`, so `:=` inference can fail.\n\n## Memory Management\n\n- **RefCounted**: (Array, Dictionary, Resource) Automatically freed when no references exist.\n- **Object\u002FNode**: Manually managed.\n  - `free()`: Immediate deletion.\n  - `queue_free()`: Safely delete at end of frame (recommended for Nodes).\n- **WeakRef**: `weakref(obj)` creates reference that doesn't prevent freeing.\n- **is_instance_valid(obj)**: Check if object hasn't been freed (for non-RefCounted).\n\n## Type Checking & Casting\n\n```gdscript\n# Type checking\nif node is Sprite2D:\n    print(\"It's a sprite\")\n\nif not enemy is null:\n    enemy.damage(10)\n\n# Safe casting\nvar sprite := node as Sprite2D\nif sprite:  # null if cast failed\n    sprite.modulate = Color.RED\n\n# Type of\nvar t = typeof(value)        # Returns TYPE_* constant\nif typeof(x) == TYPE_STRING:\n    pass\n```\n\n## Common Patterns\n\n```gdscript\n# Assert (stripped in release builds; expression not evaluated)\nassert(x > 0, \"x must be positive\")\nassert(do_check(), \"msg\")  # do_check() NOT called in release!\n\n# Groups\nadd_to_group(\"enemies\")\nget_tree().get_nodes_in_group(\"enemies\")\nis_in_group(\"enemies\")\nget_tree().call_group(\"enemies\", \"take_damage\", 10)\n\n# Scene management\nget_tree().change_scene_to_file(\"res:\u002F\u002Flevel2.tscn\")\nget_tree().reload_current_scene()\nget_tree().quit()\n\n# Instantiate scene\nvar scene := preload(\"res:\u002F\u002Fenemy.tscn\")  # Compile-time load\nvar scene2 := load(\"res:\u002F\u002Fenemy.tscn\")    # Runtime load\nvar instance := scene.instantiate()\nadd_child(instance)\n\n# Timer\nawait get_tree().create_timer(1.0).timeout\n\n# Deferred calls (run after current frame)\ncall_deferred(\"my_method\")\nset_deferred(\"property\", value)\n\n# Pause\nget_tree().paused = true                   # Pause everything\nprocess_mode = Node.PROCESS_MODE_ALWAYS    # Exempt node from pause\nprocess_mode = Node.PROCESS_MODE_PAUSABLE  # Pause with tree (default)\n```\n\n## Math Constants & Functions\n\n```gdscript\nPI, TAU, INF, NAN            # Constants\n\n# Basic\nabs(x), sign(x), floor(x), ceil(x), round(x)\nmin(a, b), max(a, b), clamp(val, min_val, max_val)\nfmod(x, y), fposmod(x, y)    # Float modulo\nwrap(val, min_val, max_val)  # Wrap around\nsnappedf(val, step)          # Snap to step\n\n# Interpolation\nlerp(a, b, t)                # Linear interpolate\nlerpf(a, b, t)               # Float lerp\ninverse_lerp(a, b, val)      # Get t from value\nsmoothstep(from, to, val)    # Smooth interpolation\nmove_toward(from, to, delta) # Move by delta toward target\n\n# Trigonometry\nsin(x), cos(x), tan(x)\nasin(x), acos(x), atan(x), atan2(y, x)\ndeg_to_rad(deg), rad_to_deg(rad)\n\n# Power\u002Fexponential\nsqrt(x), pow(base, exp), exp(x), log(x)\n\n# Random\nrandf()                      # 0.0 to 1.0\nrandi()                      # Random int\nrandf_range(from, to)        # Float in range\nrandi_range(from, to)        # Int in range\n```\n\n## Input\n\n```gdscript\n# Actions\nInput.is_action_pressed(\"move_right\")      # Held down\nInput.is_action_just_pressed(\"jump\")       # Just pressed this frame\nInput.is_action_just_released(\"fire\")      # Just released\nInput.get_action_strength(\"accelerate\")    # 0.0 to 1.0\nInput.get_axis(\"move_left\", \"move_right\")  # -1.0 to 1.0\nInput.get_vector(\"left\", \"right\", \"up\", \"down\")  # Vector2\n\n# Direct key\u002Fmouse (use actions when possible)\nInput.is_key_pressed(KEY_W)\nInput.is_mouse_button_pressed(MOUSE_BUTTON_LEFT)\nInput.get_mouse_position()\n\n# Event handling\nfunc _input(event: InputEvent) -> void:\n    if event.is_action_pressed(\"jump\"):\n        jump()\n    if event is InputEventMouseButton:\n        if event.pressed and event.button_index == MOUSE_BUTTON_LEFT:\n            shoot()\n\nfunc _unhandled_input(event: InputEvent) -> void:\n    # Called for input not consumed by UI\n    pass\n```\n\n## Spawning Patterns\n\n```gdscript\n# Path-based random spawning (enemies, pickups):\nvar spawn_loc: PathFollow2D = $SpawnPath\u002FSpawnLocation\nspawn_loc.progress_ratio = randf()\nvar mob = MobScene.instantiate()\nmob.position = spawn_loc.position\n\n# Auto-cleanup off-screen objects:\n$VisibleOnScreenNotifier2D.screen_exited.connect(queue_free)\n\n# Screen bounds clamping:\nposition = position.clamp(Vector2.ZERO, screen_size)\n```\n\n## Animation Patterns\n\n```gdscript\n# AnimationPlayer:\n$AnimationPlayer.play(\"run\")\n$AnimationPlayer.speed_scale = velocity.length() \u002F max_speed\n\n# AnimatedSprite2D — pick random animation:\n$AnimatedSprite2D.play(anim_names.pick_random())\n\n# AnimationTree blend parameters (3D):\n$AnimationTree.set(\"parameters\u002Fspeed\u002Fblend_amount\", velocity.length() \u002F max_speed)\n\n# animation_finished signal for state transitions:\n$AnimationPlayer.animation_finished.connect(_on_animation_finished)\n```\n\n## Character Facing\u002FRotation\n\n```gdscript\n# 3D — face movement direction:\nif direction != Vector3.ZERO:\n    basis = Basis.looking_at(direction)\n\n# Isometric 8-directional animation index:\nvar angle: float = rad_to_deg(direction.angle()) + 22.5\nvar dir_index: int = int(floor(angle \u002F 45.0)) % 8\n```\n\n## Jump\u002FGravity Patterns\n\n```gdscript\n# Terminal velocity:\nvelocity.y = minf(TERMINAL_VELOCITY, velocity.y + gravity * delta)\n\n# Early jump release (variable jump height):\nif Input.is_action_just_released(\"jump\") and velocity.y \u003C 0:\n    velocity.y *= 0.6\n\n# Gravity from ProjectSettings (3D):\nvar gravity: float = float(ProjectSettings.get_setting(\"physics\u002F3d\u002Fdefault_gravity\"))\n\n# Slide collision detection (e.g., stomp enemies):\nfor i in range(get_slide_collision_count()):\n    var col = get_slide_collision(i)\n    if col.get_normal().dot(Vector3.UP) > 0.7:\n        col.get_collider().squash()\n```\n\n## Movement Feel\n\n```gdscript\n# Walk\u002Fstop force asymmetry for momentum:\nif abs(input_dir) > 0.2:\n    velocity.x = move_toward(velocity.x, input_dir * MAX_SPEED, WALK_FORCE * delta)\nelse:\n    velocity.x = move_toward(velocity.x, 0, STOP_FORCE * delta)\n\n# Velocity clamping:\nvelocity.x = clamp(velocity.x, -MAX_SPEED, MAX_SPEED)\n\n# 3D smooth acceleration:\nhorizontal_vel = horizontal_vel.lerp(target_vel, accel * delta)\n\n# Analog input (triggers, sticks):\nvar throttle: float = Input.get_action_strength(\"accelerate\")\n```\n\n## State Machine Pattern\n\n```gdscript\n# Node-based hierarchical state machine:\nclass State extends Node:\n    signal finished(next_state: StringName)\n    func enter() -> void: pass\n    func exit() -> void: pass\n    func handle_input(_event: InputEvent) -> void: pass\n    func update(_delta: float) -> void: pass\n\n# State machine manages current + stack for push\u002Fpop:\nvar current_state: State\nvar states_stack: Array[State]\n```\n\n## Navigation Patterns\n\n```gdscript\n# 2D: NavigationAgent2D as child of CharacterBody2D\nfunc set_target(pos: Vector2) -> void:\n    $NavigationAgent2D.target_position = pos\n\nfunc _physics_process(_delta: float) -> void:\n    if $NavigationAgent2D.is_navigation_finished():\n        return\n    var next = $NavigationAgent2D.get_next_path_position()\n    velocity = global_position.direction_to(next) * speed\n    move_and_slide()\n\n# 3D: same pattern with NavigationAgent3D\nvar path = NavigationServer3D.map_get_path(nav_map, start, target, true)\n```\n\n## RigidBody \\_integrate_forces\n\n```gdscript\nfunc _integrate_forces(state: PhysicsDirectBodyState2D) -> void:\n    var lv = state.get_linear_velocity()\n    state.set_linear_velocity(lv)\n    for i in range(state.get_contact_count()):\n        var normal = state.get_contact_local_normal(i)\n        var collider = state.get_contact_collider_object(i)\n\n# Collision exceptions:\nbullet.add_collision_exception_with(shooter)\n```\n\n## Server API (Performance)\n\n```gdscript\n# PhysicsServer2D for 500+ objects without nodes:\nvar shape = PhysicsServer2D.circle_shape_create()\nvar body = PhysicsServer2D.body_create()\nPhysicsServer2D.body_add_shape(body, shape)\nPhysicsServer2D.body_set_state(body, PhysicsServer2D.BODY_STATE_TRANSFORM, xform)\n# MUST cleanup: PhysicsServer2D.free_rid(body) in _exit_tree()\n\n# Custom drawing for server-managed objects:\nfunc _process(_delta: float) -> void:\n    queue_redraw()\nfunc _draw() -> void:\n    for bullet in bullets:\n        draw_texture(bullet_tex, bullet.position)\n```\n\n## Custom Drawing\n\n```gdscript\ndraw_line(from, to, color, width, antialiased)\ndraw_circle(pos, radius, color, filled, width, antialiased)\ndraw_rect(Rect2(pos, size), color, filled, width, antialiased)\ndraw_polygon(points, colors)\ndraw_texture(texture, pos, modulate)\ndraw_set_transform(pos, rotation, scale)  # stateful\nqueue_redraw()  # call in _process() to trigger redraw\n```\n\n## Tween Advanced\n\n```gdscript\nvar tween = create_tween()\ntween.set_loops(3)           # loop count (0 = infinite)\ntween.set_speed_scale(2.0)\n# Parallel tweens:\ntween.parallel().tween_property(node, ^\"position\", target, 0.5)\ntween.parallel().tween_property(node, ^\"modulate\", Color.RED, 0.5)\n# Callbacks:\ntween.tween_callback(method.bind(args))\n# Method tween:\ntween.tween_method(callable, start_val, end_val, duration)\n# Relative motion:\ntween.tween_property(node, ^\"position\", offset, 0.5).as_relative()\n# State: tween.is_valid(), .is_running(), .pause(), .play(), .kill()\n```\n\n## File I\u002FO\n\n```gdscript\nvar f = FileAccess.open(path, FileAccess.WRITE)\nf.store_string(data)\nvar text = FileAccess.get_file_as_string(path)\n```\n\n## 2D Top-Down Patterns\n\n- Grid alignment assist: snap Y to nearest row center when moving horizontally (`round(pos.y \u002F tile_size) * tile_size + tile_size \u002F 2`), vice versa. Prevents snagging on corridor entrances.\n- For modifiable grids (breakable blocks), Sprite2D + StaticBody2D per cell is simpler than TileMapLayer.\n- TileMapLayer coordinate conversion: `local_to_map(position)` -> cell coords, `map_to_local(cell)` -> world position.\n\n## Camera Patterns\n\n- **Detach child camera:** Set `top_level = true` in `_ready()` on a Camera3D that's a child of a moving node.\n- **Smooth follow (3D):** `camera.position = camera.position.lerp(target.position + offset, smooth * delta)`, then `camera.look_at(target.position)`.\n- **Camera-relative input:** Remove pitch from camera basis, multiply input by it:\n  ```gdscript\n  var cam_basis = camera.global_basis\n  cam_basis = cam_basis.rotated(cam_basis.x, -cam_basis.get_euler().x)\n  var world_dir = cam_basis * Vector3(input.x, 0, input.y)\n  ```\n- **Dynamic FOV:** `camera.fov = clamp(base_fov + (speed - threshold) * factor, base_fov, max_fov)`\n","# GDScript Syntax Reference\n\n## Language Notes\n\n- Indentation-based; a script file defines a class.\n- GDScript is its own language (not Python).\n\n## Identifiers\n\n- Letters\u002Fdigits\u002F\\_; cannot start with a digit; case-sensitive.\n- Unicode letters per UAX#31 are allowed; no emoji or confusable characters.\n\n## Types\n\n**Basic:** `null`, `bool`, `int`, `float`, `String`, `StringName`, `NodePath`\n\n**Vector:** `Vector2`, `Vector2i`, `Vector3`, `Vector3i`, `Vector4`, `Vector4i`\n\n**Transform:** `Transform2D`, `Transform3D`, `Basis`, `Quaternion`\n\n**Geometry:** `Rect2`, `Rect2i`, `AABB`, `Plane`\n\n**Other:** `Color`, `RID`, `Object`, `Callable`, `Signal`\n\n**Containers:** `Array`, `Array[Type]`, `Dictionary`, `Dictionary[K, V]`\n\n**Packed:** `PackedByteArray`, `PackedInt32Array`, `PackedInt64Array`, `PackedFloat32Array`,\n`PackedFloat64Array`, `PackedStringArray`, `PackedVector2Array`, `PackedVector3Array`,\n`PackedVector4Array`, `PackedColorArray`\n\n**Variant:** Means untyped; not a real type for inference by default.\n\n**Value vs reference:** Built-in types (`bool`, `int`, `float`, `Vector2\u002F3`, `AABB`, `Transform2D\u002F3D`, `Color`, `Rect2`, etc.) are value types — passing them to a function creates a copy, assignments inside the function do NOT update the caller. `Object`, `Array`, `Dictionary`, and packed arrays are reference types (use `duplicate()` to copy).\n\n## Keywords\n\n```\nif elif else match when for while break continue pass return\nclass class_name extends is in as not and or\nfunc signal var const enum static\nself super await preload yield breakpoint assert\ntrue false null void\nPI TAU INF NAN\n```\n\n## Operators (by precedence)\n\n```\n()                           # Grouping\nx.attr  x[\"key\"]  x()        # Attribute, subscript, call\nawait x                      # Await\n**                           # Power\n~ + -                        # Unary (bitwise NOT, positive, negative)\n* \u002F %                        # Multiply, divide, modulo\n+ -                          # Add, subtract\n\u003C\u003C >>                        # Bit shift\n&                            # Bitwise AND\n^                            # Bitwise XOR\n|                            # Bitwise OR\n\u003C > \u003C= >= == !=              # Comparison\nin  not in  is  is not       # Containment, type check\nnot  !                       # Boolean NOT (alias)\nand  &&                      # Boolean AND (alias)\nor   ||                      # Boolean OR (alias)\nx if cond else y             # Ternary\nas                           # Type cast\n= += -= *= \u002F= **= etc.       # Assignment\n```\n\nOperator notes:\n\n- `**` is left-associative; ternary is right-associative.\n- `\u002F` does integer division when both operands are `int`.\n- `%` only works on `int`; use `fmod()` for floats. Use `posmod()`\u002F`fposmod()` for math-style remainders.\n- Assignment is not allowed inside expressions.\n- `==`\u002F`!=` can compare different types but may cause runtime errors. Use `is_same()` for strict comparison, `is_equal_approx()` for floats.\n\n## Literals\n\n```\nnull, true, false\n45, 0x8f51, 0b101010, 3.14, 1_000_000, 3.14_159\n\"Hello\", 'Hi', \"\"\"Multi\"\"\", r\"Raw\", r'''Raw'''\n&\"name\"       # StringName\n^\"Node\u002FPath\"  # NodePath\n$NodePath     # get_node(\"NodePath\")\n%UniqueNode   # get_node(\"%UniqueNode\")\n```\n\nCommon escapes: `\\n \\t \\r \\a \\b \\f \\v \\\\ \\\" \\' \\uXXXX \\UXXXXXX`.\nRaw strings do not process escapes and cannot end with an odd number of `\\`.\n\n## Variables & Constants\n\n```gdscript\nvar x = 5                    # Variant (no type)\nvar y: int = 5               # Explicit type\nvar z := 5                   # Inferred with := (literal has clear type)\nconst MAX := 100             # Constant\nstatic var count := 0        # Class-level static\n\n# Type inference only works when the RHS has a concrete type.\n# Variant-returning functions or data access break := inference.\nvar bad := abs(speed)                   # ERROR: Cannot infer type from Variant\nvar bad2 := clamp(val, 0.0, 1.0)        # ERROR: Same problem\nvar bad3 := min(a, b)                   # ERROR: Same problem\nvar good: float = abs(speed)            # OK: explicit type annotation\nvar also_ok = abs(speed)                # OK: untyped (Variant)\n\nenum State { IDLE, RUN, JUMP }\nenum { ONE = 1, TWO, THREE }\n\n# Named enums are dictionaries with extra methods\nState.IDLE               # 0\nState.keys()             # [\"IDLE\", \"RUN\", \"JUMP\"]\nState.values()           # [0, 1, 2]\n```\n\nInitialization order (members):\n\n- Default value by type (or `null` for untyped\u002FObjects).\n- Declaration order initializers.\n- `_init()`.\n- Exported values (scenes\u002Fresources).\n- `@onready` values.\n- `_ready()`.\n\n## Functions\n\n```gdscript\nfunc add(a: int, b: int) -> int:\n    return a + b\n\nfunc greet(name := \"World\") -> void:  # Default parameter\n    print(\"Hello, \", name)\n\nfunc process(items: Array[String]) -> void:  # Typed array\n    for item in items:\n        print(item)\n\n# Lambda (explicit return required)\nvar double := func(x): return x * 2\n\n# Lambda capture behavior:\n# - Primitives captured by value at creation time (won't see later changes)\n# - Arrays\u002Fdicts\u002Fobjects captured by reference (content changes shared)\n# - Cannot reassign outer variables (CONFUSABLE_CAPTURE_REASSIGNMENT warning)\nvar x = 42\nvar arr = []\nvar fn = func():\n    print(x)       # Always 42, even if x changed after lambda creation\n    arr.append(1)  # Shared with outer scope\n    x = 99         # Warning: only affects lambda's copy\n\n# Static function\nstatic func create() -> MyClass:\n    return MyClass.new()\n\n# Function reference (Callable)\nvar callback = my_function  # Gets Callable without calling\ncallback.call(arg1, arg2)   # Must use .call() to invoke\n\n# Static constructor (called on load)\nstatic func _static_init() -> void:\n    pass\n\n# Variadic (rest parameter; must be last, no default)\nfunc sum(...values: Array) -> int:\n    var total := 0\n    for n in values:\n        total += n\n    return total\n```\n\nVariadic notes:\n\n- Only one rest parameter, and it must be last.\n- Rest parameter cannot be `Array[Type]` (use `Array`).\n- You cannot unpack\u002Frest-spread arguments on call sites (use `callv`).\n\n## Control Flow\n\n```gdscript\n# Conditionals\nif condition:\n    pass\nelif other:\n    pass\nelse:\n    pass\n\n# Ternary\nvar result = \"yes\" if condition else \"no\"\n\n# Match (pattern matching)\nmatch value:\n    1:\n        print(\"one\")\n    2, 3, 4:\n        print(\"two to four\")\n    [var a, var b]:\n        print(a, b)\n    {\"key\": var v}:\n        print(v)\n    var x when x > 10:       # Guard clause\n        print(\"big: \", x)\n    _:\n        print(\"default\")\n\n# Loops\nfor i in range(10):          # 0 to 9\n    if i == 5:\n        continue             # Skip iteration\n    if i == 8:\n        break                # Exit loop\nfor item in array:\n    pass\nfor name: String in names:   # Typed loop variable\n    print(name.to_upper())\nfor key in dict:\n    var val = dict[key]\nwhile condition:\n    pass\n```\n\n## Classes\n\n```gdscript\nclass_name MyClass\nextends Node2D\n\n# Abstract class\u002Fmethod (cannot be instantiated or attached to nodes)\n@abstract class Shape:\n    @abstract func draw() -> void  # No body; subclasses must implement\n\nsignal health_changed(new_value: int)\nsignal died\n\n@export var speed: float = 100.0\n@export_range(0, 100) var health: int = 100\n@onready var sprite: Sprite2D = $Sprite2D\n\nvar _private := 0\n\n# Property with getter\u002Fsetter\nvar score: int:\n    get:\n        return score       # Direct access inside own getter (no recursion)\n    set(value):\n        score = clamp(value, 0, 100)  # Direct access inside own setter\n        score_changed.emit(score)\n\n# Alternative property syntax (reusing functions)\nvar my_prop: get = _get_prop, set = _set_prop\n\n# Setter\u002Fgetter NOT called: during initialization and inside own accessor\nvar x: int = 5  # Setter not called here\n\nfunc _init() -> void:\n    pass\n\nfunc _ready() -> void:\n    super._ready()  # Call parent\n    # self.prop is runtime-checked (works for dynamic\u002Fchild properties)\n    # prop alone is compile-time checked (must exist in current class)\n\nfunc something(p1, p2) -> void:\n    super(p1, p2)   # Call overridden method by name\n\nfunc _process(delta: float) -> void:\n    pass\n\n# Inner class\nclass InnerEnemy:\n    var hp := 100\n    func take_damage(amount: int) -> void:\n        hp -= amount\n```\n\n## Node References\n\n```gdscript\n$NodeName                    # Get child node\n$Path\u002FTo\u002FNode                # Nested path\n%UniqueNode                  # Scene-unique node (set in editor)\nget_node(\"Path\")             # Equivalent to $\nget_parent()                 # Parent node\nget_tree()                   # SceneTree\nget_node_or_null(\"Path\")     # Returns null if not found\nhas_node(\"Path\")             # Check existence\n```\n\n## Signals\n\n```gdscript\n# Define\nsignal my_signal\nsignal value_changed(new_val: int)\n\n# Emit\nmy_signal.emit()\nvalue_changed.emit(42)\n\n# Connect\nother_node.my_signal.connect(_on_signal)\nother_node.my_signal.connect(func(): print(\"lambda\"))\n\n# Connect with bound arguments\nother_node.my_signal.connect(_on_signal.bind(\"extra_data\"))\n\n# Disconnect\nother_node.my_signal.disconnect(_on_signal)\n\n# Await\nawait my_signal\nawait get_tree().create_timer(1.0).timeout\nvar result = await some_async_func()\n```\n\n## Annotations\n\n```gdscript\n@export var visible_in_editor: int\n@export_range(0, 100, 1) var clamped: int\n@export_enum(\"Low\", \"Medium\", \"High\") var quality: int\n@export_file(\"*.png\") var texture_path: String\n@export_node_path(\"Sprite2D\") var sprite_path: NodePath\n@export_group(\"Movement\")    # Group following exports\n@export_subgroup(\"Speed\")    # Subgroup\n\n@onready var node := $Child  # Resolved when _ready() runs\n\n@tool  # Script runs in editor (be careful with queue_free!)\n@static_unload # Unload script when no references (for static vars)\n@warning_ignore(\"unused_parameter\")\n\n@icon(\"res:\u002F\u002Ficon.png\")  # Custom class icon\n```\n\nAnnotations:\n\n- Multiple annotations can be stacked; they apply to the next non-annotation line.\n- `@onready` with `@export` is not recommended; `@onready` overwrites exported values\n  and triggers the `ONREADY_WITH_EXPORT` warning.\n\n## Comments & Regions\n\n```gdscript\n# Line comment\n## Documentation comment (for script docs\u002Finspector tooltips)\n\n#region Terrain\nfunc generate_lakes():\n    pass\n#endregion\n```\n\nEditor highlights markers (case-sensitive):\n\n- Critical (red): `ALERT`, `ATTENTION`, `CAUTION`, `CRITICAL`, `DANGER`, `SECURITY`\n- Warning (yellow): `BUG`, `DEPRECATED`, `FIXME`, `HACK`, `TASK`, `TODO`, `WARNING`\n- Notice (green): `INFO`, `NOTE`, `NOTICE`, `TEST`\n\n## Line Continuation\n\n```gdscript\nvar a = 1 + \\\n2 + \\\n3\n```\n\n## Strings\n\n```gdscript\n# Regular strings\nvar s = \"Hello\\nWorld\"       # With escape sequences\nvar raw = r\"C:\\path\\file\"    # Raw string (no escapes)\nvar multi = \"\"\"\nLine 1\nLine 2\n\"\"\"                          # Triple-quoted multiline\n\n# Special literals\nvar sname: StringName = &\"my_action\"  # StringName (interned)\nvar npath: NodePath = ^\"Path\u002FTo\u002FNode\" # NodePath literal\n\n# Format strings\n\"Hello %s\" % name            # Single value\n\"x=%d y=%d\" % [x, y]         # Multiple values\n\"%.2f\" % 3.14159             # Float precision\n\n# Common methods\ns.length()                   # String length\ns.to_upper()                 # HELLO\ns.to_lower()                 # hello\ns.strip_edges()              # Trim whitespace\ns.split(\",\")                 # Split to array\n\",\".join([\"a\", \"b\"])         # Join array\ns.begins_with(\"He\")          # Prefix check\ns.ends_with(\"ld\")            # Suffix check\ns.find(\"ll\")                 # Find substring index\ns.replace(\"l\", \"L\")          # Replace\nstr(42)                      # Convert to string\nint(\"42\")                    # Parse int\nfloat(\"3.14\")                # Parse float\n```\n\n## Arrays & Dictionaries\n\n```gdscript\n# Arrays\nvar arr := [1, 2, 3]\nvar typed: Array[int] = [1, 2, 3]\n\n# Cannot assign Array[SubType] to Array[BaseType] directly\nvar nodes2d: Array[Node2D] = [Node2D.new()]\nvar nodes: Array[Node] = []\n# nodes = nodes2d  # ERROR: incompatible types\nnodes.assign(nodes2d)  # OK: copies contents\narr.append(4)                # Add to end\narr.push_front(0)            # Add to start\narr.insert(2, 99)            # Insert at index\narr.pop_back()               # Remove and return last\narr.pop_front()              # Remove and return first\narr.remove_at(1)             # Remove at index\narr.erase(2)                 # Remove first occurrence of value\narr.size()                   # Length\narr.is_empty()               # Check empty\narr.has(2)                   # Check contains\narr.find(2)                  # Find index (-1 if not found)\narr.sort()                   # Sort in place\narr.reverse()                # Reverse in place\narr.duplicate()              # Shallow copy\narr.shuffle()                # Randomize order\narr.slice(1, 3)              # Subarray [1:3)\narr.map(func(x): return x*2) # Transform\narr.filter(func(x): return x > 0)  # Filter\narr.reduce(func(a, b): return a + b, 0)  # Reduce\n\n# Dictionaries\nvar dict := {\"key\": \"value\", \"num\": 42}\nvar typed: Dictionary[String, int] = {\"a\": 1}\ndict[\"new_key\"] = 100        # Add\u002Fupdate\ndict.get(\"key\", \"default\")   # Get with default\ndict.has(\"key\")              # Check key exists\ndict.erase(\"key\")            # Remove key\ndict.keys()                  # Array of keys\ndict.values()                # Array of values\ndict.size()                  # Number of entries\ndict.is_empty()              # Check empty\ndict.merge(other_dict)       # Merge in place\n```\n\nArray\u002Fdict notes:\n\n- `Array` == `Array[Variant]`. `Dictionary` == `Dictionary[Variant, Variant]`.\n- Dictionary\u002Farray access returns `Variant`, so `:=` inference can fail.\n\n## Memory Management\n\n- **RefCounted**: (Array, Dictionary, Resource) Automatically freed when no references exist.\n- **Object\u002FNode**: Manually managed.\n  - `free()`: Immediate deletion.\n  - `queue_free()`: Safely delete at end of frame (recommended for Nodes).\n- **WeakRef**: `weakref(obj)` creates reference that doesn't prevent freeing.\n- **is_instance_valid(obj)**: Check if object hasn't been freed (for non-RefCounted).\n\n## Type Checking & Casting\n\n```gdscript\n# Type checking\nif node is Sprite2D:\n    print(\"It's a sprite\")\n\nif not enemy is null:\n    enemy.damage(10)\n\n# Safe casting\nvar sprite := node as Sprite2D\nif sprite:  # null if cast failed\n    sprite.modulate = Color.RED\n\n# Type of\nvar t = typeof(value)        # Returns TYPE_* constant\nif typeof(x) == TYPE_STRING:\n    pass\n```\n\n## Common Patterns\n\n```gdscript\n# Assert (stripped in release builds; expression not evaluated)\nassert(x > 0, \"x must be positive\")\nassert(do_check(), \"msg\")  # do_check() NOT called in release!\n\n# Groups\nadd_to_group(\"enemies\")\nget_tree().get_nodes_in_group(\"enemies\")\nis_in_group(\"enemies\")\nget_tree().call_group(\"enemies\", \"take_damage\", 10)\n\n# Scene management\nget_tree().change_scene_to_file(\"res:\u002F\u002Flevel2.tscn\")\nget_tree().reload_current_scene()\nget_tree().quit()\n\n# Instantiate scene\nvar scene := preload(\"res:\u002F\u002Fenemy.tscn\")  # Compile-time load\nvar scene2 := load(\"res:\u002F\u002Fenemy.tscn\")    # Runtime load\nvar instance := scene.instantiate()\nadd_child(instance)\n\n# Timer\nawait get_tree().create_timer(1.0).timeout\n\n# Deferred calls (run after current frame)\ncall_deferred(\"my_method\")\nset_deferred(\"property\", value)\n\n# Pause\nget_tree().paused = true                   # Pause everything\nprocess_mode = Node.PROCESS_MODE_ALWAYS    # Exempt node from pause\nprocess_mode = Node.PROCESS_MODE_PAUSABLE  # Pause with tree (default)\n```\n\n## Math Constants & Functions\n\n```gdscript\nPI, TAU, INF, NAN            # Constants\n\n# Basic\nabs(x), sign(x), floor(x), ceil(x), round(x)\nmin(a, b), max(a, b), clamp(val, min_val, max_val)\nfmod(x, y), fposmod(x, y)    # Float modulo\nwrap(val, min_val, max_val)  # Wrap around\nsnappedf(val, step)          # Snap to step\n\n# Interpolation\nlerp(a, b, t)                # Linear interpolate\nlerpf(a, b, t)               # Float lerp\ninverse_lerp(a, b, val)      # Get t from value\nsmoothstep(from, to, val)    # Smooth interpolation\nmove_toward(from, to, delta) # Move by delta toward target\n\n# Trigonometry\nsin(x), cos(x), tan(x)\nasin(x), acos(x), atan(x), atan2(y, x)\ndeg_to_rad(deg), rad_to_deg(rad)\n\n# Power\u002Fexponential\nsqrt(x), pow(base, exp), exp(x), log(x)\n\n# Random\nrandf()                      # 0.0 to 1.0\nrandi()                      # Random int\nrandf_range(from, to)        # Float in range\nrandi_range(from, to)        # Int in range\n```\n\n## Input\n\n```gdscript\n# Actions\nInput.is_action_pressed(\"move_right\")      # Held down\nInput.is_action_just_pressed(\"jump\")       # Just pressed this frame\nInput.is_action_just_released(\"fire\")      # Just released\nInput.get_action_strength(\"accelerate\")    # 0.0 to 1.0\nInput.get_axis(\"move_left\", \"move_right\")  # -1.0 to 1.0\nInput.get_vector(\"left\", \"right\", \"up\", \"down\")  # Vector2\n\n# Direct key\u002Fmouse (use actions when possible)\nInput.is_key_pressed(KEY_W)\nInput.is_mouse_button_pressed(MOUSE_BUTTON_LEFT)\nInput.get_mouse_position()\n\n# Event handling\nfunc _input(event: InputEvent) -> void:\n    if event.is_action_pressed(\"jump\"):\n        jump()\n    if event is InputEventMouseButton:\n        if event.pressed and event.button_index == MOUSE_BUTTON_LEFT:\n            shoot()\n\nfunc _unhandled_input(event: InputEvent) -> void:\n    # Called for input not consumed by UI\n    pass\n```\n\n## Spawning Patterns\n\n```gdscript\n# Path-based random spawning (enemies, pickups):\nvar spawn_loc: PathFollow2D = $SpawnPath\u002FSpawnLocation\nspawn_loc.progress_ratio = randf()\nvar mob = MobScene.instantiate()\nmob.position = spawn_loc.position\n\n# Auto-cleanup off-screen objects:\n$VisibleOnScreenNotifier2D.screen_exited.connect(queue_free)\n\n# Screen bounds clamping:\nposition = position.clamp(Vector2.ZERO, screen_size)\n```\n\n## Animation Patterns\n\n```gdscript\n# AnimationPlayer:\n$AnimationPlayer.play(\"run\")\n$AnimationPlayer.speed_scale = velocity.length() \u002F max_speed\n\n# AnimatedSprite2D — pick random animation:\n$AnimatedSprite2D.play(anim_names.pick_random())\n\n# AnimationTree blend parameters (3D):\n$AnimationTree.set(\"parameters\u002Fspeed\u002Fblend_amount\", velocity.length() \u002F max_speed)\n\n# animation_finished signal for state transitions:\n$AnimationPlayer.animation_finished.connect(_on_animation_finished)\n```\n\n## Character Facing\u002FRotation\n\n```gdscript\n# 3D — face movement direction:\nif direction != Vector3.ZERO:\n    basis = Basis.looking_at(direction)\n\n# Isometric 8-directional animation index:\nvar angle: float = rad_to_deg(direction.angle()) + 22.5\nvar dir_index: int = int(floor(angle \u002F 45.0)) % 8\n```\n\n## Jump\u002FGravity Patterns\n\n```gdscript\n# Terminal velocity:\nvelocity.y = minf(TERMINAL_VELOCITY, velocity.y + gravity * delta)\n\n# Early jump release (variable jump height):\nif Input.is_action_just_released(\"jump\") and velocity.y \u003C 0:\n    velocity.y *= 0.6\n\n# Gravity from ProjectSettings (3D):\nvar gravity: float = float(ProjectSettings.get_setting(\"physics\u002F3d\u002Fdefault_gravity\"))\n\n# Slide collision detection (e.g., stomp enemies):\nfor i in range(get_slide_collision_count()):\n    var col = get_slide_collision(i)\n    if col.get_normal().dot(Vector3.UP) > 0.7:\n        col.get_collider().squash()\n```\n\n## Movement Feel\n\n```gdscript\n# Walk\u002Fstop force asymmetry for momentum:\nif abs(input_dir) > 0.2:\n    velocity.x = move_toward(velocity.x, input_dir * MAX_SPEED, WALK_FORCE * delta)\nelse:\n    velocity.x = move_toward(velocity.x, 0, STOP_FORCE * delta)\n\n# Velocity clamping:\nvelocity.x = clamp(velocity.x, -MAX_SPEED, MAX_SPEED)\n\n# 3D smooth acceleration:\nhorizontal_vel = horizontal_vel.lerp(target_vel, accel * delta)\n\n# Analog input (triggers, sticks):\nvar throttle: float = Input.get_action_strength(\"accelerate\")\n```\n\n## State Machine Pattern\n\n```gdscript\n# Node-based hierarchical state machine:\nclass State extends Node:\n    signal finished(next_state: StringName)\n    func enter() -> void: pass\n    func exit() -> void: pass\n    func handle_input(_event: InputEvent) -> void: pass\n    func update(_delta: float) -> void: pass\n\n# State machine manages current + stack for push\u002Fpop:\nvar current_state: State\nvar states_stack: Array[State]\n```\n\n## Navigation Patterns\n\n```gdscript\n# 2D: NavigationAgent2D as child of CharacterBody2D\nfunc set_target(pos: Vector2) -> void:\n    $NavigationAgent2D.target_position = pos\n\nfunc _physics_process(_delta: float) -> void:\n    if $NavigationAgent2D.is_navigation_finished():\n        return\n    var next = $NavigationAgent2D.get_next_path_position()\n    velocity = global_position.direction_to(next) * speed\n    move_and_slide()\n\n# 3D: same pattern with NavigationAgent3D\nvar path = NavigationServer3D.map_get_path(nav_map, start, target, true)\n```\n\n## RigidBody \\_integrate_forces\n\n```gdscript\nfunc _integrate_forces(state: PhysicsDirectBodyState2D) -> void:\n    var lv = state.get_linear_velocity()\n    state.set_linear_velocity(lv)\n    for i in range(state.get_contact_count()):\n        var normal = state.get_contact_local_normal(i)\n        var collider = state.get_contact_collider_object(i)\n\n# Collision exceptions:\nbullet.add_collision_exception_with(shooter)\n```\n\n## Server API (Performance)\n\n```gdscript\n# PhysicsServer2D for 500+ objects without nodes:\nvar shape = PhysicsServer2D.circle_shape_create()\nvar body = PhysicsServer2D.body_create()\nPhysicsServer2D.body_add_shape(body, shape)\nPhysicsServer2D.body_set_state(body, PhysicsServer2D.BODY_STATE_TRANSFORM, xform)\n# MUST cleanup: PhysicsServer2D.free_rid(body) in _exit_tree()\n\n# Custom drawing for server-managed objects:\nfunc _process(_delta: float) -> void:\n    queue_redraw()\nfunc _draw() -> void:\n    for bullet in bullets:\n        draw_texture(bullet_tex, bullet.position)\n```\n\n## Custom Drawing\n\n```gdscript\ndraw_line(from, to, color, width, antialiased)\ndraw_circle(pos, radius, color, filled, width, antialiased)\ndraw_rect(Rect2(pos, size), color, filled, width, antialiased)\ndraw_polygon(points, colors)\ndraw_texture(texture, pos, modulate)\ndraw_set_transform(pos, rotation, scale)  # stateful\nqueue_redraw()  # call in _process() to trigger redraw\n```\n\n## Tween Advanced\n\n```gdscript\nvar tween = create_tween()\ntween.set_loops(3)           # loop count (0 = infinite)\ntween.set_speed_scale(2.0)\n# Parallel tweens:\ntween.parallel().tween_property(node, ^\"position\", target, 0.5)\ntween.parallel().tween_property(node, ^\"modulate\", Color.RED, 0.5)\n# Callbacks:\ntween.tween_callback(method.bind(args))\n# Method tween:\ntween.tween_method(callable, start_val, end_val, duration)\n# Relative motion:\ntween.tween_property(node, ^\"position\", offset, 0.5).as_relative()\n# State: tween.is_valid(), .is_running(), .pause(), .play(), .kill()\n```\n\n## File I\u002FO\n\n```gdscript\nvar f = FileAccess.open(path, FileAccess.WRITE)\nf.store_string(data)\nvar text = FileAccess.get_file_as_string(path)\n```\n\n## 2D Top-Down Patterns\n\n- Grid alignment assist: snap Y to nearest row center when moving horizontally (`round(pos.y \u002F tile_size) * tile_size + tile_size \u002F 2`), vice versa. Prevents snagging on corridor entrances.\n- For modifiable grids (breakable blocks), Sprite2D + StaticBody2D per cell is simpler than TileMapLayer.\n- TileMapLayer coordinate conversion: `local_to_map(position)` -> cell coords, `map_to_local(cell)` -> world position.\n\n## Camera Patterns\n\n- **Detach child camera:** Set `top_level = true` in `_ready()` on a Camera3D that's a child of a moving node.\n- **Smooth follow (3D):** `camera.position = camera.position.lerp(target.position + offset, smooth * delta)`, then `camera.look_at(target.position)`.\n- **Camera-relative input:** Remove pitch from camera basis, multiply input by it:\n  ```gdscript\n  var cam_basis = camera.global_basis\n  cam_basis = cam_basis.rotated(cam_basis.x, -cam_basis.get_euler().x)\n  var world_dir = cam_basis * Vector3(input.x, 0, input.y)\n  ```\n- **Dynamic FOV:** `camera.fov = clamp(base_fov + (speed - threshold) * factor, base_fov, max_fov)`\n",{"name":5,"description":7},"main","f14d6437b86dcd1257925a71587a253624705809","skills\u002Fgodot-gdscript",0,"https:\u002F\u002Fgithub.com\u002Fdragoscirjan\u002Fopencode-config","https:\u002F\u002Fgithub.com\u002Fdragoscirjan","http:\u002F\u002Flunaticthinker.me","2026-08-23 18:29:44",{"source":8,"skillName":5,"commands":56,"prompt":66,"zipAvailable":67},[57,60,63],{"tool":58,"command":59},"npx","npx skills add dragoscirjan\u002Fopencode-config --skill godot-gdscript",{"tool":61,"command":62},"bunx","bunx skills add dragoscirjan\u002Fopencode-config --skill godot-gdscript",{"tool":64,"command":65},"pnpm","pnpm dlx skills add dragoscirjan\u002Fopencode-config --skill godot-gdscript","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fdragoscirjan\u002Fopencode-config\u002Fblob\u002Fmain\u002Fskills\u002Fgodot-gdscript\u002FSKILL.md",true,[],[70,86,105,121,141,153],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":42},"01M6GVBX5M8KVG8EZP2QTYZDGB","productivity-clarify","Guidelines for clarifying ambiguous tasks. Load when the immediate user request lacks execution context.","https:\u002F\u002Fgithub.com\u002Fdragoscirjan\u002Fopencode-config\u002Fblob\u002Fmain\u002Fskills\u002Fproductivity-clarify\u002FSKILL.md",[],[77,78,79,80,81,41,82,83,84,85],"productivity","productivity clarify","clarify","user","tasks","guidelines","user request","context","execution",{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":42},"01M6GVBQX6W1C1RAZE43EQ9NEY","productivity-caveman","Ultra-compressed communication mode. Cuts token usage ~75% by dropping filler, articles, and pleasantries while keeping full technical accuracy. Use when user says \"caveman mode\", \"talk like caveman\", \"use caveman\", \"less tokens\", \"be brief\", or invokes \u002Fcaveman.","https:\u002F\u002Fgithub.com\u002Fdragoscirjan\u002Fopencode-config\u002Fblob\u002Fmain\u002Fskills\u002Fproductivity-caveman\u002FSKILL.md",[],[77,93,94,95,80,96,97,98,99,100,101,102,103,104],"caveman","productivity caveman","technical","use","full","token","tokens","usage","mode","ultra","brief","communication",{"skillNo":106,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":109,"categories":110,"keywords":114,"publishedAt":42},"01M6GVBHX6SZRBE7440A5RA6X9","mcp-tools","External MCP tools reference. Load at task start.","https:\u002F\u002Fgithub.com\u002Fdragoscirjan\u002Fopencode-config\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-tools\u002FSKILL.md",[111],{"categoryNo":112,"categoryName":113,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",[115,116,117,36,118,119,41,120],"Tools","mcp tools","MCP","start","task","at",{"skillNo":122,"name":123,"nameZh":6,"description":124,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":125,"categories":126,"keywords":131,"publishedAt":42},"01M6GVBD1AZ6NWNYAAQ9J9E71X","mcp-tools-godot","Godot MCP servers reference — editor, diagnostics, testing, docs, runtime. Load when doing Godot game dev.","https:\u002F\u002Fgithub.com\u002Fdragoscirjan\u002Fopencode-config\u002Fblob\u002Fmain\u002Fskills\u002Fmcp-tools-godot\u002FSKILL.md",[127,130],{"categoryNo":128,"categoryName":129,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":112,"categoryName":113,"taxonomyType":21,"taxonomyTypeDesc":22},[115,132,29,116,117,133,134,135,136,137,138,139,36,140,41],"mcp tools godot","mcp servers","testing","docs","editor","diagnostics","dev","game","runtime",{"skillNo":142,"name":143,"nameZh":6,"description":144,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":145,"categories":146,"keywords":147,"publishedAt":42},"01M6GVBA6DM84KYRDPP1Q83GBJ","lang-zig","Zig development standards and tooling.","https:\u002F\u002Fgithub.com\u002Fdragoscirjan\u002Fopencode-config\u002Fblob\u002Fmain\u002Fskills\u002Flang-zig\u002FSKILL.md",[],[148,149,150,151,152],"zig","lang zig","development","tooling","standards",{"skillNo":154,"name":155,"nameZh":6,"description":156,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":157,"categories":158,"keywords":159,"publishedAt":42},"01M6GVB8PKXRMMJ4B2YPZG1350","lang-yaml","YAML standards and tooling.","https:\u002F\u002Fgithub.com\u002Fdragoscirjan\u002Fopencode-config\u002Fblob\u002Fmain\u002Fskills\u002Flang-yaml\u002FSKILL.md",[],[160,161,151,152],"yaml","lang yaml"]