Sprite + Hitbox JSON → Godot Game Integration

Convert sprite frames and polygon hitbox JSON into Godot 4 CollisionPolygon2D hurtboxes and attack hitboxes.

Updated Apr 5, 2026
One-click install
npx skills add https://github.com/NaphatPound/template-godot-hitbox --skill sprite-hitbox-json-godot-game-integration
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Sprite + Hitbox JSON → Godot Game Integration
Source: https://github.com/NaphatPound/template-godot-hitbox/tree/main
Command: npx skills add https://github.com/NaphatPound/template-godot-hitbox --skill sprite-hitbox-json-godot-game-integration

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes assets (resource) components.

What problem does it solve?

Manually aligning animated sprites with per-frame collision polygons is time-consuming and error-prone; this skill generates a working Godot 4 integration that keeps hurtboxes and attack hitboxes synchronized to the current animation frame.

Core Features & Use Cases

  • Sprite + hitbox conversion workflow: Converts per-frame PNG animation sprites and matching polygon hitbox JSON into Godot CollisionPolygon2D data.
  • Frame-accurate hurtbox/attack behavior: Updates polygons on every animation frame, enabling attack areas only when the frame’s attack polygon is active.
  • Facing-direction mirroring: Flips/mirrors hitbox polygons for left/right facing so you can reuse one set of JSON data.
  • Debug overlay for validation: Draws transparent hitbox polygons in distinct colors (green for hurt/body, red for attack) to verify correctness in-game.

What it’s best for

Use it when you need reliable hit detection for 2D characters (players and bosses), especially for complex polygon-based attacks where frame-by-frame accuracy matters.

Quick Start

Ask the assistant to integrate the HitboxController component into your CharacterBody2D scene and wire it to your existing animation folders and JSON hitbox files.

Frequently Asked Questions about Sprite + Hitbox JSON → Godot Game Integration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I sync CollisionPolygon2D hitboxes with animated sprites in Godot 4?

To sync CollisionPolygon2D hitboxes with animated sprites in Godot 4, this integration loads per-frame polygon JSON and updates the collision shapes deterministically whenever the animation frame changes. This ensures hurtboxes and attack hitboxes match the exact visual frame.

Can I mirror 2D combat hitboxes for left and right facing directions?

You can mirror 2D combat hitboxes for left and right facing directions by automatically flipping the polygon vertices. This allows you to reuse a single set of JSON hitbox data for both directions without creating duplicate assets.

What is the best way to convert per-frame PNG sprites and JSON polygon data into Godot collision shapes?

The best way to convert per-frame PNG sprites and JSON polygon data into Godot collision shapes is to auto-discover the matching assets and generate CollisionPolygon2D data. This workflow eliminates manual alignment by directly translating the JSON coordinates into usable Godot 4 collision polygons.

How do I visualize and debug 2D hitbox and hurtbox polygons during gameplay?

To visualize and debug 2D hitbox and hurtbox polygons during gameplay, you can use a built-in debug overlay. It draws transparent collision polygons in distinct colors, using green for hurtboxes and red for attack hitboxes, to verify frame accuracy in-game.

Does this Godot 4 frame-accurate hitbox integration work for boss attack systems?

This Godot 4 frame-accurate hitbox integration works for boss attack systems and melee combat. It updates attack areas deterministically on every animation frame, ensuring complex polygon-based collision detection only activates when the attack polygon is active.

Do I need to manually align collision polygons for every animation frame?

You do not need to manually align collision polygons for every animation frame. The integration handles the synchronization automatically by reading the per-frame polygon hitbox JSON and applying it to the CollisionPolygon2D whenever the animated sprite updates.