creating tiny games 🎮, web experiments 🕸️. follow me for rare, but fun posts 💎

California
Joined October 2023
I really like that we’re defining state explicitly now. But I also definitely missed a couple during this conversion that kind of made me crazy. Don’t be me, use some codemod tool! When you use any rune in a file, all your old “reactive” variables are secretly not reactive 😱
1
4
892
Prop definition changes I’m slightly positive on. They are a little more annoying to type, but it’s much easier to spot props in a file now imo. Spot the props in these shots if you don’t believe me 👀
1
5
1,001
Defining deeply reactive structures are a little weird with classes, to be honest. It feels like misdirection. And at the call sites, you don’t want to dig (like `controls.map[‘LeftArrow’].on`). So: more helpers. A good thing in some ways, but here it felt awkward.
2
3
1,129
Next spot was this messy store that held state for the hue, saturation, and “on” status. I had some awkward update logic here because I placed `hue` and `sat` together. Svelte 5’s organization made this situation simpler, easier to read. Also removed the need for a separate types
1
6
1,310
First: stores. A simple writable became more verbose in order to keep the same clarity. Callers now use `chickenDinner.hasWon` instead of `winnerChickenDinner`. The plus side of classes is they make you want to encapsulate, like this `chickenDinner.win()` function.
1
1
5
1,262
You can see all the code at my github: github.com/backlitbytes/lil-…. I’m very open to bug reports, pull requests, forking, etc. I’d rather a like/share here than a star there, but I’m a beggar not a chooser!
1
1
118
One thing I kind of hated as I implemented it was the cartridge animations - they are done by animating left/top values (not performant, not easy to code 😢). I know there are better ways, but it works well enough for now (just don’t resize the window after selecting a cart 👀)
1
2
61
I made the gameboy more flexible than it needed to be thinking I might mess with the dimensions of it during the gameplay, but honestly the scope of this “little” project needed to be cut down so I could finally share it ✂️
1
1
63
The "games" are built with PhaserJS, which felt like overkill, but worked really well for the simple “find the next cartridge” gameplay. It was also really easy to integrate PhaserJS logic with Svelte stores.
1
1
78
You can control the Gameboy with touch 👈, your keyboard ⌨️, or your mouse 🐁. This meant I couldn’t rely just on active button states as I originally wanted to, but ultimately it’s about the user experience so my code had to be less pretty.
1
1
90