Our 2D game character grew 3% taller every time he walked
12 hours ago
- #game development
- #visual alignment
- #animation bug
- Leo's character in Leonardo's Moon Ship had an animation bug causing him to grow taller when walking and lift off the ground.
- The issue arose from inconsistent canvas sizes across animations, leading to different character heights and positions.
- Naive setup used a single global scale and offset, causing visual drift and feet misalignment with the collision body.
- Fixed by computing per-animation metrics at load: visual feet line and character height averaged across frames.
- Reference animation idle_right used to align others via custom scales and offsets, ensuring feet position consistency.
- The fix also resolved Leo's shadow placement automatically, anchoring it to the constant feet Y position.
- Solution involved scanning frames for opaque rows to determine visual feet, ignoring anti-aliasing halos.