Snappy Squirrel Rides Again with Amazon Q and Phaser: A Refactoring Success
I dug up my old Corona SDK codebase to see if I could resurrect some old games
Jen Looper
Amazon Employee
Published Nov 3, 2024
Last Modified Nov 7, 2024
It took a while, but I finally brought this old game back to life!
For a little context, back in 2014 (wow, it was ten years ago!) my father and I cooked up a concept to teach about personal finance in a way kids would understand. He came up with the idea of a story series about a little squirrel who has to work to save and store nuts under adverse circumstances. Snappy really does get put through the wringer!
You can read 5 of the books we produced with art produced by my daughter on my web site. These e-books, still available on the web, however, were originally books for iPad written and configured using Corona SDK, a terrific 2D game development platform that was paired with the first tech community I integrated with as a junior developer. The original e-books had the stories that you can still read, with the little interactive ladybug element, but also a game attached to each book so that kids could have a little fun on top of the learning. Cool, no?
Here's what it looks like on the web:
When I removed books out of the Apple and Google app stores, I converted them to a web-friendly format using VuePress (which also needs to be refactored and updated) and archived the original files, including each e-book's little paired game.
Could these games be brought back to life? With a little help from Amazon Q Developer, they could! This is the endless scroller game, 'Run Snappy Run!' - dodge the stones, and grab the flying acorns!
It was very helpful to point .lua files (Corona SDK was written in Lua) to Amazon Q Developer in VS Code and get tips on how to convert the files. I learned that CoronaSDK is now called Solar2D but still only works on mobile and a desktop app. For the web, Amazon Q suggested using Phaser.io, a JavaScript game engine with a friendly, easy-to-learn API.
Wanting to stick with the simple 2D scroller format, I figured it was worth a try. And with a code helper, the refactoring turned into a learning experience. After an initial conversion from the .lua game to JavaScript, I was able to get pertinent help from the editor to explain what various functions were doing:
And after a considerable amount of time because I'm rusty with game dev... I present to you: Run, Snappy, Run! You can play it online here and find the code on GitHub.
Simple but fun. Use your spacebar to jump over stones and collect the nuts.
If you love game development, take a look at the current Hackathon on DevPost.
Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.