Successfully integrated 16 new PixelLab 80x80 character sprites with full 8-directional animations and breathing effects, while maintaining backward compatibility with legacy 64x64 sprites.
Tool: tools/convert_pixellab_to_spritesheet.py
- Created automated converter for PixelLab exports → Phaser atlases
- Generated 16 character sprite sheets (PNG + JSON)
- Each character: 80x80 frames, 8 directions, multiple animations
- Output:
public/break_escape/assets/characters/
Documentation:
tools/README_SPRITE_CONVERTER.mdpublic/break_escape/assets/characters/README.mdpublic/break_escape/assets/characters/SPRITE_SHEETS_SUMMARY.md
File: public/break_escape/js/core/game.js
Added atlas loading for all 16 characters:
- 8 female characters (hacker, office worker, security guard, spy, scientist, etc.)
- 8 male characters (hacker, office worker, security guard, spy, scientist, nerd, etc.)
- Legacy sprites (hacker, hacker-red) preserved
File: public/break_escape/js/systems/npc-sprites.js
New Features:
setupAtlasAnimations()- Creates animations from JSON metadata- Automatic format detection (atlas vs legacy)
- Direction mapping: east/west/north/south → right/left/up/down
- Animation type mapping: breathing-idle, walk, cross-punch, etc.
Fixes:
- ✅ 8-directional animation support (was only using 2 directions)
- ✅ Collision box adjustment for 80x80 sprites
- ✅ Animation stuck on single frame (
sprite.anims.exists→scene.anims.exists) - ✅ Initial frame selection (frame 20 → named frame for atlas)
Documentation: docs/8_DIRECTIONAL_FIX.md, docs/NPC_ANIMATION_FIX.md, docs/FRAME_NUMBER_FIX.md
File: public/break_escape/js/core/player.js
New Features:
createAtlasPlayerAnimations()- Creates player animations from atlascreateLegacyPlayerAnimations()- Handles legacy sprites- Updated movement functions for 8-directional support
- Collision box detection and adjustment
Configuration:
- Reads sprite from
scenarioConfig.player.spriteSheet - Supports
idleFrameRateandwalkFrameRatesettings - Automatic detection of atlas vs legacy
Optimization: Breathing animations now play at 6 fps for natural effect
- 4 frames per direction = 0.67 second cycle
- ~90 breaths per minute (realistic resting rate)
- Subtle, polished, not distracting
Documentation: docs/BREATHING_ANIMATIONS.md
For 80x80 sprites:
- Player: 18x10 box at offset (31, 66)
- NPCs: 20x10 box at offset (30, 66)
For 64x64 sprites (legacy):
- Player: 15x10 box at offset (25, 50)
- NPCs: 18x10 box at offset (23, 50)
Documentation: docs/COLLISION_BOX_FIX.md
File: scenarios/m01_first_contact/scenario.json.erb
Updated all characters:
| Character | Old Sprite | New Sprite | Type |
|---|---|---|---|
| Player (Agent 0x00) | hacker | female_hacker_hood | Female hacker |
| Agent 0x99 | hacker | male_spy | Male spy |
| Sarah Martinez | hacker-red | female_office_worker | Female office worker |
| Kevin Park | hacker | male_nerd | Male nerd |
| Maya Chen | hacker-red | female_scientist | Female scientist |
| Derek Lawson | hacker | male_security_guard | Male security guard |
Configuration format:
"spriteConfig": {
"idleFrameRate": 6, // Breathing animation
"walkFrameRate": 10 // Walk animation
}Created comprehensive documentation:
docs/SPRITE_SYSTEM.md- Complete sprite system guidedocs/8_DIRECTIONAL_FIX.md- 8-directional animation fixdocs/BREATHING_ANIMATIONS.md- Breathing animation detailsdocs/COLLISION_BOX_FIX.md- Collision box adjustmentdocs/NPC_ANIMATION_FIX.md- Animation playback fixdocs/FRAME_NUMBER_FIX.md- Initial frame selection fixCHANGELOG_SPRITES.md- Complete change log
✅ Atlas-based animations - Read from JSON metadata
✅ 8-directional support - All cardinal and diagonal directions
✅ Automatic detection - Atlas vs legacy sprite format
✅ Direction mapping - Atlas directions → game directions
✅ Animation mapping - breathing-idle → idle, etc.
✅ Frame rate configuration - Configurable per animation type
✅ Sprite size detection - 80x80 vs 64x64
✅ Dynamic offsets - Calculated based on sprite size
✅ Feet positioning - Accurate collision at feet
✅ Backward compatible - Legacy sprites still work
✅ 16 HTTP requests instead of 2,500+ individual images
✅ Single texture per character - Efficient GPU usage
✅ No texture swaps - Faster rendering
✅ Pre-defined animations - No runtime generation
public/break_escape/js/core/game.js- Atlas loadingpublic/break_escape/js/core/player.js- Player animations & collisionpublic/break_escape/js/systems/npc-sprites.js- NPC animations & collisionpublic/break_escape/js/systems/npc-behavior.js- 8-directional support
public/break_escape/assets/characters/- 16 new characters (32 files: PNG + JSON)
scenarios/m01_first_contact/scenario.json.erb- Updated character sprites
tools/convert_pixellab_to_spritesheet.py- Sprite sheet convertertools/README_SPRITE_CONVERTER.md- Tool documentationtools/requirements.txt- Python dependencies
- 8 new documentation files in
docs/ - Updated READMEs in assets folder
female_hacker_hood- 48 animations, 256 framesfemale_hacker- 37 animations, 182 framesfemale_office_worker- 32 animations, 152 framesfemale_security_guard- 40 animations, 208 framesfemale_telecom- 24 animations, 128 framesfemale_spy- 40 animations, 208 framesfemale_scientist- 30 animations, 170 frameswoman_bow- 31 animations, 149 frames
male_hacker_hood- 40 animations, 208 framesmale_hacker- 40 animations, 208 framesmale_office_worker- 40 animations, 224 framesmale_security_guard- 40 animations, 208 framesmale_telecom- 37 animations, 182 framesmale_spy- 40 animations, 208 framesmale_scientist- 30 animations, 170 framesmale_nerd- 40 animations, 208 frames
All characters support:
- breathing-idle - 8 directions, 4 frames each @ 6 fps
- walk - 8 directions, 6 frames each @ 10 fps
- cross-punch - 8 directions, 6 frames each
- lead-jab - 8 directions, 3 frames each
- falling-back-death - 7-8 frames
- taking-punch - 6 frames (select characters)
- pull-heavy-object - 6 frames (select characters)
All features tested and working:
- ✅ Player movement with 8-directional animations
- ✅ NPC patrol with 8-directional animations
- ✅ Breathing idle animations (6 fps, natural)
- ✅ Collision detection at correct position
- ✅ Animation transitions smooth
- ✅ Legacy sprites still functional
- ✅ No texture loading errors
- ✅ Performance improved (fewer HTTP requests)
✅ 100% backward compatible
- Legacy 64x64 sprites continue to work
- Automatic format detection
- No changes needed to existing scenarios using legacy sprites
- Both systems coexist in the same game
None currently identified.
All reported issues have been fixed:
- ✅ NPCs only using 2 directions → Fixed (8-directional support)
- ✅ NPCs stuck on single frame → Fixed (animation check)
- ✅ Frame "20" error → Fixed (initial frame selection)
- ✅ Collision box misalignment → Fixed (size detection)
{
"player": {
"spriteSheet": "female_hacker_hood",
"spriteTalk": "assets/characters/hacker-talk.png",
"spriteConfig": {
"idleFrameRate": 6,
"walkFrameRate": 10
}
},
"npcs": [
{
"id": "sarah",
"spriteSheet": "female_office_worker",
"spriteConfig": {
"idleFrameRate": 6,
"walkFrameRate": 10
}
}
]
}Potential improvements:
- Dynamic portrait generation from sprite sheets
- Character customization system
- Animation state machine (idle → walk → attack)
- More character variants
- Custom color tinting
- Attack animations integration
- Death animations integration
- Hit reactions
Before:
- 2,500+ individual PNG files
- Multiple HTTP requests per character
- Texture swaps during animation
After:
- 16 sprite sheets (32 files total with JSON)
- 1 request per character (2 files: PNG + JSON)
- Single texture per character
- Result: ~99% reduction in asset loading
Add PixelLab sprite sheet support with 8-directional animations
Features:
- 16 new character sprites (80x80, atlas-based)
- 8-directional animations with breathing effects
- Automatic format detection (atlas vs legacy)
- Adjusted collision boxes for 80x80 sprites
- Frame rate configuration per animation type
Fixes:
- NPCs stuck on single frame (animation check)
- NPCs only using 2 directions (flip detection)
- Frame "20" error (initial frame selection)
- Collision box misalignment (size detection)
Files:
- New: 16 characters in public/break_escape/assets/characters/
- Modified: game.js, player.js, npc-sprites.js, npc-behavior.js
- Modified: scenario.json.erb (updated all character sprites)
- Added: Sprite sheet converter tool and documentation
Backward compatible with legacy 64x64 sprites.
✅ Functionality: All features working as designed
✅ Performance: 99% reduction in asset loading
✅ Quality: Smooth 8-directional animations with breathing
✅ Compatibility: Legacy sprites fully supported
✅ Documentation: Comprehensive guides created
✅ Testing: All scenarios tested and verified
The sprite system update is complete and production-ready!