For our second project (June 14 – 21st), we decided to work on Lovely-snake. This game is a Snake clone written in Lua with the LOVE framework by our teammate Josh. I have always been a huge fan of Snake, so I was excited to work on this project. By the time we got started on it as a team, Josh had already written the basics of the game and had a working demo ready.
One of the things that surprised me about Lua was that it doesn’t have native support for classes, so as the game’s code grew, it became apparent that we’d need to implement classes somehow. We wound up using Middleclass, which works similarly to class systems of other languages, but uses a special class() function to prepare a variable to work as a class:
-- define myClass myClass = class('myClass') -- create an instance of myClass myObject = myClass:new()
Some of the things we worked on were: a scoring system, killing the snake when he hits walls or himself, a scrolling level camera, and a level tile. See our contributions here: https://github.com/jbttn/lovely-snake/pull/13/files
This project still has a lot of TODOs, so if you’d like to contribute, read them here: https://github.com/jbttn/lovely-snake/issues
Josh is working on his own blog post about the level system we worked on, so keep a lookout for that.