Back to articles
I Built a Pixel Art Roguelite in Vanilla JS — Here Are 6 Things That Broke (And What I Learned)

I Built a Pixel Art Roguelite in Vanilla JS — Here Are 6 Things That Broke (And What I Learned)

via Dev.to BeginnersJason Guo

Full article: Pixel dungeon dev log I spent the last few weeks building a roguelite dungeon crawler using nothing but vanilla JavaScript and HTML5 Canvas. No React. No Phaser. No build tools. Just 6 JS files, a 16×16 pixel art tileset, and a growing list of bugs I didn't see coming. The game has procedural dungeon generation, 5+ enemy types with AI state machines, a full camp system with crafting stations, procedural Web Audio music, and an equipment/inventory system. It runs from a single HTML file. Here's what actually went wrong — and the fixes that made the biggest difference. 1. The Enemy That Disappeared When You Got Close The most absurd bug I encountered: enemies became invisible when the player walked toward them. The cause? State transitions. When an enemy switches from patrol to chase (triggered by proximity), there's a window of 2-3 frames where the state variable updates but the sprite reference hasn't resolved yet. Canvas drawImage() with an undefined source doesn't throw

Continue reading on Dev.to Beginners

Opens in a new tab

Read Full Article
6 views

Related Articles