I decided to look for a framework or library that would make the whole process easier, and JS has a LOT of those. I ended up going with a beta framework that was specifically designed to help make games with JS.
CraftyJS is in active development, and all of the code for it can be found on their Github. They actually released a new beta version about 2 weeks ago. I chose it because it looked intuitive and easy to use, even for someone with no prior JS experience. Turns out I was right – it is fairly intuitive. There are, however, some drawbacks and challenges that I faced during the creation of this project.
Because JS is such a popular language, though, not all is lost. Tools like JSLint and JSHint can help in resolving errors and adhering to conventional formatting (though JSLint is a little too strict about some conventions, in my personal opinion), and IDEs like WebStorm will catch syntactic errors and provides support for other libraries and frameworks. It is still a step more difficult to debug than compiled languages, though. It is no surprise why there are so many frameworks and libraries that exist to solve many of its annoying quirks.
The Good of CraftyJS
By far the best things about Crafty besides its general ease of use is its documentation. It is well-written, and best of all, it provides examples of how to use it. There are multiple demos on the website whose code is also on GitHub, which was useful for some problem-solving when the documentation was insufficient. Overall, I’ve found Crafty’s simplicity to be a great and pretty fun thing to use, which is not what I expected at all.
Problems with Crafty
Even though its demo code is on GitHub and it has great documentation, Crafty otherwise has a pretty small community. This means it’s harder to find help for specific issues. Additionally, a recent issue has come up where directional keys don’t work in the newest version of Firefox, so I will have to come up with a workaround. However, I have been able to work through every other issue or challenge I’ve faced thanks mostly to Crafty’s great documentation, which will point out potential issues and how to solve them (ex. “the shared object trap“).
I will post a link to the working version of the game and my final thoughts once it’s completed, though you can see the in-progress code on my GitHub.