[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79NX6H94JWB8VM0KGWN4W53":3,"skill-same:01M79NX6H94JWB8VM0KGWN4W53":51},{"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":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":29,"updatedAt":30,"install":31,"resources":44},"01M79NX6H94JWB8VM0KGWN4W53","godot-2d-movement",null,"Implement 2D kinematic character movement in Godot 4.7 with CharacterBody2D and move_and_slide(): platformer run\u002Fjump with gravity, top-down 8-direction motion, slope handling, and reading collisions. Use when coding a 2D player or enemy controller, a platformer or top-down character, or fixing move_and_slide()\u002F is_on_floor() behavior in a .tscn with a CharacterBody2D.","JunMystery\u002FAgent-Guidance","JunMystery","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F161468934?v=4","01M79MTMV8F0BY8NK1A92RA8A0","Jun","01M79MTMWCFBKPHN5B25E6V20B",0,"MIT","https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance\u002Fblob\u002Fmain\u002Fskills\u002Fgodot-2d-movement\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: godot-2d-movement\ndescription: >\n  Implement 2D kinematic character movement in Godot 4.7 with CharacterBody2D and\n  move_and_slide(): platformer run\u002Fjump with gravity, top-down 8-direction motion,\n  slope handling, and reading collisions. Use when coding a 2D player or enemy\n  controller, a platformer or top-down character, or fixing move_and_slide()\u002F\n  is_on_floor() behavior in a .tscn with a CharacterBody2D.\n---\n\n# Godot 2D Movement (4.x)\n\nBuild responsive 2D character controllers with `CharacterBody2D` and the argument-less\n`move_and_slide()`. Targets **Godot 4.7**.\n\n## When to use\n\n- Use when scripting a 2D player\u002Fenemy that moves and collides: platformer (gravity +\n  jump) or top-down (free 8-direction), slope walking, or wall\u002Ffloor detection.\n- Use when `move_and_slide()` \"does nothing\", the character sinks through floors, or\n  `is_on_floor()` is always false.\n\n**When *not* to use:** dynamic rigid bodies, areas, raycasts, collision layers →\n`godot-physics`; tile-based levels → `godot-tilemap`; full platformer game template →\nthe `platformer` genre skill; engine-agnostic feel tuning → `physics-tuning`.\n\n## Core workflow\n\n1. **Use `CharacterBody2D`** with a `CollisionShape2D` child. It is script-driven: it\n   does not fall or react to forces on its own.\n2. **Set the `velocity` property, then call `move_and_slide()`** (no arguments in 4.x).\n   The method reads `velocity`, moves the body, slides along surfaces, and updates\n   `velocity` to reflect what actually happened.\n3. **Do it in `_physics_process(delta)`** — `move_and_slide()` uses the physics step's\n   delta internally, so do not multiply `velocity` by `delta` yourself.\n4. **Platformer:** add gravity to `velocity.y` each tick, jump by setting `velocity.y`\n   negative when `is_on_floor()`.\n5. **Top-down:** build a direction from input and scale by speed; set\n   `motion_mode = MOTION_MODE_FLOATING` so there is no \"floor\u002Fwall\" distinction.\n6. **Read results** with `is_on_floor()`, `is_on_wall()`, `get_wall_normal()`, and\n   `get_slide_collision(i)` after the call.\n\n## Patterns\n\n### 1. Platformer controller (gravity, jump, slopes)\n\n```gdscript\nextends CharacterBody2D\n\n@export var speed := 200.0\n@export var jump_velocity := -400.0\n@export var gravity := 1200.0          # pixels\u002Fsec^2 (tune to taste)\n\nfunc _physics_process(delta: float) -> void:\n    # Apply gravity while airborne.\n    if not is_on_floor():\n        velocity.y += gravity * delta\n\n    # Jump only when grounded (Input action set in Project Settings > Input Map).\n    if Input.is_action_just_pressed(\"jump\") and is_on_floor():\n        velocity.y = jump_velocity\n\n    # Horizontal input: -1, 0, or 1.\n    var dir := Input.get_axis(\"move_left\", \"move_right\")\n    if dir != 0.0:\n        velocity.x = dir * speed\n    else:\n        velocity.x = move_toward(velocity.x, 0.0, speed)   # decelerate to a stop\n\n    move_and_slide()   # 4.x: no arguments; uses and updates `velocity`\n```\n\nA fixed `gravity` export keeps tuning simple. To follow the project setting\n(*Physics > 2D > Default Gravity*) and any `Area2D` gravity overrides instead, use\n`velocity += get_gravity() * delta`, as the built-in CharacterBody2D script template does.\n\n### 2. Top-down 8-direction movement\n\n```gdscript\nextends CharacterBody2D\n\n@export var speed := 220.0\n\nfunc _ready() -> void:\n    motion_mode = CharacterBody2D.MOTION_MODE_FLOATING  # no floor\u002Fceiling concept\n\nfunc _physics_process(_delta: float) -> void:\n    # get_vector returns a normalized-ish Vector2 from four input actions.\n    var input := Input.get_vector(\"move_left\", \"move_right\", \"move_up\", \"move_down\")\n    velocity = input * speed\n    move_and_slide()\n```\n\n### 3. Reading slide collisions after moving\n\n```gdscript\nfunc _physics_process(delta: float) -> void:\n    # ... set velocity ...\n    move_and_slide()\n    for i in get_slide_collision_count():\n        var c := get_slide_collision(i)\n        var other := c.get_collider()\n        if other and other.is_in_group(\"enemies\"):\n            take_damage(1)        # touched an enemy while moving\n```\n\n### 4. Coyote time (forgiving jump just after leaving a ledge)\n\n```gdscript\n@export var coyote_time := 0.1\nvar _coyote := 0.0\n\nfunc _physics_process(delta: float) -> void:\n    if not is_on_floor():\n        velocity.y += gravity * delta\n        _coyote -= delta\n    else:\n        _coyote = coyote_time\n\n    if Input.is_action_just_pressed(\"jump\") and _coyote > 0.0:\n        velocity.y = jump_velocity\n        _coyote = 0.0\n    # ... horizontal input + move_and_slide() ...\n```\n\n## Pitfalls\n\n- **3.x signature is gone.** `move_and_slide(velocity)` (returning the new velocity) was\n  removed. In 4.x set the `velocity` property and call `move_and_slide()` with no args.\n  `move_and_slide(velocity, Vector2.UP)` will not parse.\n- **Multiplying velocity by delta.** `move_and_slide()` already accounts for the physics\n  delta. Setting `velocity = dir * speed * delta` makes the body crawl.\n- **Movement in `_process`** instead of `_physics_process` causes frame-rate-dependent,\n  jittery motion. Always move in `_physics_process`.\n- **`is_on_floor()` always false** when `up_direction` is wrong (default `Vector2.UP`),\n  there is no `CollisionShape2D`, or you never called `move_and_slide()` this frame.\n- **Sinking through floors** usually means the collision shape is missing\u002Fzero-sized, the\n  floor body is on a layer this body's mask doesn't include, or you moved the body via\n  `position +=` instead of velocity + `move_and_slide()`.\n- **Slope slipping while idle:** keep `floor_stop_on_slope = true` (default) and raise\n  `floor_snap_length` (default 1 px) so the body sticks to downward slopes.\n\n## References\n\n- For one-way platforms, moving platforms, jump buffering, variable jump height, and\n  `move_and_collide()` (manual collision response), read `references\u002Fcontroller-recipes.md`.\n\n## Related skills\n\n- `godot-physics` — collision layers\u002Fmasks, areas, raycasts, rigid bodies.\n- `godot-tilemap` — building the levels this character walks on.\n- `godot-animation` — driving sprite\u002Fskeletal animation from movement state.\n- `camera-systems` — follow camera, deadzone, and look-ahead that track this character.\n- `platformer` \u002F `input-systems` — full genre template and rebindable input.\n","# Godot 2D Movement (4.x)\n\nBuild responsive 2D character controllers with `CharacterBody2D` and the argument-less\n`move_and_slide()`. Targets **Godot 4.7**.\n\n## When to use\n\n- Use when scripting a 2D player\u002Fenemy that moves and collides: platformer (gravity +\n  jump) or top-down (free 8-direction), slope walking, or wall\u002Ffloor detection.\n- Use when `move_and_slide()` \"does nothing\", the character sinks through floors, or\n  `is_on_floor()` is always false.\n\n**When *not* to use:** dynamic rigid bodies, areas, raycasts, collision layers →\n`godot-physics`; tile-based levels → `godot-tilemap`; full platformer game template →\nthe `platformer` genre skill; engine-agnostic feel tuning → `physics-tuning`.\n\n## Core workflow\n\n1. **Use `CharacterBody2D`** with a `CollisionShape2D` child. It is script-driven: it\n   does not fall or react to forces on its own.\n2. **Set the `velocity` property, then call `move_and_slide()`** (no arguments in 4.x).\n   The method reads `velocity`, moves the body, slides along surfaces, and updates\n   `velocity` to reflect what actually happened.\n3. **Do it in `_physics_process(delta)`** — `move_and_slide()` uses the physics step's\n   delta internally, so do not multiply `velocity` by `delta` yourself.\n4. **Platformer:** add gravity to `velocity.y` each tick, jump by setting `velocity.y`\n   negative when `is_on_floor()`.\n5. **Top-down:** build a direction from input and scale by speed; set\n   `motion_mode = MOTION_MODE_FLOATING` so there is no \"floor\u002Fwall\" distinction.\n6. **Read results** with `is_on_floor()`, `is_on_wall()`, `get_wall_normal()`, and\n   `get_slide_collision(i)` after the call.\n\n## Patterns\n\n### 1. Platformer controller (gravity, jump, slopes)\n\n```gdscript\nextends CharacterBody2D\n\n@export var speed := 200.0\n@export var jump_velocity := -400.0\n@export var gravity := 1200.0          # pixels\u002Fsec^2 (tune to taste)\n\nfunc _physics_process(delta: float) -> void:\n    # Apply gravity while airborne.\n    if not is_on_floor():\n        velocity.y += gravity * delta\n\n    # Jump only when grounded (Input action set in Project Settings > Input Map).\n    if Input.is_action_just_pressed(\"jump\") and is_on_floor():\n        velocity.y = jump_velocity\n\n    # Horizontal input: -1, 0, or 1.\n    var dir := Input.get_axis(\"move_left\", \"move_right\")\n    if dir != 0.0:\n        velocity.x = dir * speed\n    else:\n        velocity.x = move_toward(velocity.x, 0.0, speed)   # decelerate to a stop\n\n    move_and_slide()   # 4.x: no arguments; uses and updates `velocity`\n```\n\nA fixed `gravity` export keeps tuning simple. To follow the project setting\n(*Physics > 2D > Default Gravity*) and any `Area2D` gravity overrides instead, use\n`velocity += get_gravity() * delta`, as the built-in CharacterBody2D script template does.\n\n### 2. Top-down 8-direction movement\n\n```gdscript\nextends CharacterBody2D\n\n@export var speed := 220.0\n\nfunc _ready() -> void:\n    motion_mode = CharacterBody2D.MOTION_MODE_FLOATING  # no floor\u002Fceiling concept\n\nfunc _physics_process(_delta: float) -> void:\n    # get_vector returns a normalized-ish Vector2 from four input actions.\n    var input := Input.get_vector(\"move_left\", \"move_right\", \"move_up\", \"move_down\")\n    velocity = input * speed\n    move_and_slide()\n```\n\n### 3. Reading slide collisions after moving\n\n```gdscript\nfunc _physics_process(delta: float) -> void:\n    # ... set velocity ...\n    move_and_slide()\n    for i in get_slide_collision_count():\n        var c := get_slide_collision(i)\n        var other := c.get_collider()\n        if other and other.is_in_group(\"enemies\"):\n            take_damage(1)        # touched an enemy while moving\n```\n\n### 4. Coyote time (forgiving jump just after leaving a ledge)\n\n```gdscript\n@export var coyote_time := 0.1\nvar _coyote := 0.0\n\nfunc _physics_process(delta: float) -> void:\n    if not is_on_floor():\n        velocity.y += gravity * delta\n        _coyote -= delta\n    else:\n        _coyote = coyote_time\n\n    if Input.is_action_just_pressed(\"jump\") and _coyote > 0.0:\n        velocity.y = jump_velocity\n        _coyote = 0.0\n    # ... horizontal input + move_and_slide() ...\n```\n\n## Pitfalls\n\n- **3.x signature is gone.** `move_and_slide(velocity)` (returning the new velocity) was\n  removed. In 4.x set the `velocity` property and call `move_and_slide()` with no args.\n  `move_and_slide(velocity, Vector2.UP)` will not parse.\n- **Multiplying velocity by delta.** `move_and_slide()` already accounts for the physics\n  delta. Setting `velocity = dir * speed * delta` makes the body crawl.\n- **Movement in `_process`** instead of `_physics_process` causes frame-rate-dependent,\n  jittery motion. Always move in `_physics_process`.\n- **`is_on_floor()` always false** when `up_direction` is wrong (default `Vector2.UP`),\n  there is no `CollisionShape2D`, or you never called `move_and_slide()` this frame.\n- **Sinking through floors** usually means the collision shape is missing\u002Fzero-sized, the\n  floor body is on a layer this body's mask doesn't include, or you moved the body via\n  `position +=` instead of velocity + `move_and_slide()`.\n- **Slope slipping while idle:** keep `floor_stop_on_slope = true` (default) and raise\n  `floor_snap_length` (default 1 px) so the body sticks to downward slopes.\n\n## References\n\n- For one-way platforms, moving platforms, jump buffering, variable jump height, and\n  `move_and_collide()` (manual collision response), read `references\u002Fcontroller-recipes.md`.\n\n## Related skills\n\n- `godot-physics` — collision layers\u002Fmasks, areas, raycasts, rigid bodies.\n- `godot-tilemap` — building the levels this character walks on.\n- `godot-animation` — driving sprite\u002Fskeletal animation from movement state.\n- `camera-systems` — follow camera, deadzone, and look-ahead that track this character.\n- `platformer` \u002F `input-systems` — full genre template and rebindable input.\n",{"name":5,"description":7},"main","5d0a87185c0e172c3901e2a6e5916b6d544b8b94","skills\u002Fgodot-2d-movement","https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance","https:\u002F\u002Fgithub.com\u002FJunMystery","AI is the typist, I am the architect. Building efficient, secure, and user-centric products through disciplined AI prompt engineering.","2026-11-13 17:41:25",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add JunMystery\u002FAgent-Guidance --skill godot-2d-movement",{"tool":37,"command":38},"bunx","bunx skills add JunMystery\u002FAgent-Guidance --skill godot-2d-movement",{"tool":40,"command":41},"pnpm","pnpm dlx skills add JunMystery\u002FAgent-Guidance --skill godot-2d-movement","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance\u002Fblob\u002Fmain\u002Fskills\u002Fgodot-2d-movement\u002FSKILL.md",true,[45],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":50},"references\u002Fcontroller-recipes.md","REFERENCE","参考文档",3503,"https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance\u002Fblob\u002Fmain\u002Fskills\u002Fgodot-2d-movement\u002Freferences\u002Fcontroller-recipes.md",[52,58,64,70,76,82],{"skillNo":53,"name":54,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":55,"categories":56,"keywords":57,"publishedAt":19},"01M79QR1E309VJ6CTQKB32AWWA","zero-trust-architecture-cheat-sheet","https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance\u002Fblob\u002Fmain\u002Fskills\u002Fzero-trust-architecture-cheat-sheet\u002FSKILL.md",[],[],{"skillNo":59,"name":60,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":19},"01M79QQV7GHYR02DYGN41S23WN","xss-filter-evasion-cheat-sheet","https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance\u002Fblob\u002Fmain\u002Fskills\u002Fxss-filter-evasion-cheat-sheet\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M79QQNSN7YB8XB61FFSCS3WH","xs-leaks-cheat-sheet","https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance\u002Fblob\u002Fmain\u002Fskills\u002Fxs-leaks-cheat-sheet\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M79QQHZZJKFDY9132G5A65C2","xpath-injection-prevention-cheat-sheet","https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance\u002Fblob\u002Fmain\u002Fskills\u002Fxpath-injection-prevention-cheat-sheet\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M79QQB9ZSD3DJG8658EHQXR1","xml-security-cheat-sheet","https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance\u002Fblob\u002Fmain\u002Fskills\u002Fxml-security-cheat-sheet\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M79QQ60WKV7PFMXWT9CW8PM6","xml-external-entity-prevention-cheat-sheet","https:\u002F\u002Fgithub.com\u002FJunMystery\u002FAgent-Guidance\u002Fblob\u002Fmain\u002Fskills\u002Fxml-external-entity-prevention-cheat-sheet\u002FSKILL.md",[],[]]