Skip to content

Fix sprite transparency: remove purple background from Mario sprite sheet#1

Open
qa-philipp-bauhofer wants to merge 1 commit into
qaware:mainfrom
qa-philipp-bauhofer:claude/elated-bohr-9b1f32
Open

Fix sprite transparency: remove purple background from Mario sprite sheet#1
qa-philipp-bauhofer wants to merge 1 commit into
qaware:mainfrom
qa-philipp-bauhofer:claude/elated-bohr-9b1f32

Conversation

@qa-philipp-bauhofer
Copy link
Copy Markdown

Summary

  • The assets/sprite.png sprite sheet used opaque colored backgrounds (three color variants: #002980, #0000A8, #9290FF) as a legacy NES-era color-key convention instead of proper alpha-channel transparency
  • This caused a visible purple rectangle to render around Mario whenever he walked in front of trees or other background elements
  • Fixed by applying a flood-fill algorithm starting from the image boundary to remove all connected background regions while preserving internal sprite pixels

What changed

assets/sprite.png — background pixels replaced with alpha=0 (transparent):

  • First pass: exact color-match on corner color (0, 41, 140) → 113,072 px transparent
  • Second pass: flood-fill from image boundary covering all three background color variants → 68,118 additional px transparent
  • Total: ~181,000 px made transparent out of ~274,000 total

What a reviewer should know

  • The flood-fill approach was chosen over global color replacement to avoid accidentally removing valid sprite pixels that happen to share a background color (a risk with NES palette sprites that reuse colors)
  • The palette reference panels in the lower-right section of the sprite sheet retain their colored backgrounds — these are informational annotations by the sprite sheet author and are not used by the game
  • The sprite regions used by Player.ts (idle + 3 walk frames at y=8) were verified post-fix: ~40–52% of each cell is now transparent, consistent with character sprite shapes

Test plan

  • Run npm run dev and open http://localhost:8000
  • Walk Mario left/right past background trees — no purple rectangle should appear around the character
  • Verify idle and all 3 walk animation frames render without background artifacts

🤖 Generated with Claude Code

The sprite PNG used opaque colored backgrounds (three variants: #002980,
#0000A8, #9290FF) as a legacy color-key convention, causing a visible
purple rectangle to render around Mario whenever he walked in front of
trees or other background elements.

Fixed by applying flood-fill from the image boundary to remove all
connected background regions, preserving internal sprite pixels.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant