S
spritesynthDOCS

Weapon & Item Sprite Generation

Generate game-ready weapons, tools, consumables, and interactive items with multiple states.

Overview

Weapons and items are the most plentiful assets in any game. A single RPG might have 50+ weapons, 30 armors, 100 consumables, and dozens of key items. spritesynth's object system handles these efficiently: each item is an object with optional states (idle, active, broken) and exportable sprite sheets.

Step 1: Generate an Item Icon

For inventory icons and UI sprites, use the simple image generation endpoint:

curl -X POST https://api.spritesynth.com/v1/generations/image \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
"prompt": "pixel art health potion icon, red liquid, glass bottle, 16x16",
    "width": 16,
    "height": 16
  }'

Item icons work best at 16×16 or 24×24 pixels — match this to your inventory grid size.

Step 2: Create a Full Game Object

For items that appear in the world (weapons on the ground, chests, doors), create a game object:

curl -X POST https://api.spritesynth.com/v1/objects \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Iron Sword",
    "description": "A basic iron longsword",
    "prompt": "pixel art iron sword, steel blade, leather grip, 32x32, game asset",
    "width": 32,
    "height": 32
  }'

The response includes an object_id and an asset_id for the generated sprite.

Step 3: Add Item States

Objects can have multiple states representing different conditions or interactions:

curl -X POST https://api.spritesynth.com/v1/objects/{object_id}/states \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "active",
    "asset_id": "glowing_sword_asset_id",
    "frame_count": 2,
    "frame_width": 32,
    "frame_height": 32,
    "frame_duration_ms": 500
  }'

curl -X POST https://api.spritesynth.com/v1/objects/{object_id}/states \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "broken",
    "asset_id": "broken_sword_asset_id",
    "frame_count": 1,
    "frame_width": 32,
    "frame_height": 32
  }'

Common item states: idle (default), active (glowing/powered), broken (depleted/destroyed).

Step 4: Export for Your Game Engine

Download the complete item with all states as a ZIP:

curl -o item-export.zip https://api.spritesynth.com/v1/objects/{object_id}/export-zip \
  -H "Authorization: Bearer YOUR_API_KEY"

The ZIP contains per-state sprite sheets and metadata.json with frame coordinates, state names, and animation timing.

Tips

  • Batch weapon types — Generate all swords in one session (iron, steel, mythril), then all bows, then all staves. Systematic variation saves prompting time.
  • Size matters — World sprites are 32×32; inventory icons are 16×16. Generate at the world size and downscale for icons.
  • State planning — Not every item needs every state. Keys only need idle; chests need idle and open; magical items benefit from active.
  • Consistent palette across tiers — Keep the same palette structure for iron/steel/mythril variants so they look like a progression.

Need help?

Join our Discord community for support and tips.

Was this page helpful?

On this page