Implementing Lines in TIC-80 - Part 1 (Setup)

As stated in the intro, Lines is a JavaScript game created by Dmitry Baranovskiy. Players attempt to match balls of 7 colors in straight lines of 5.

Game goal is to arrange balls of the same colour in a straight lines (every direction). 5 or more balls on a straight line are removed and points are given. Longer lines give more points to you. Crossing lines count together.
-- Lines homepage

Balls can be moved to any space where any amount of moves may get a ball from one space to the other. For example, assuming there are no formations of balls blocking an approach, one ball may be moved from one corner to the next.

Setting up TIC-80

First, you should start by opening TIC-80 (however you have it set up) and starting a new cart with new, followed by the language you wish to use (languages available for use include JavaScript, Lua, Moonscript, Wren, and Squirrel). For this tutorial/writeup, I will use Lua (TIC-80's Lua is PUC Rio Lua 5.3.1).

I would suggest blanking out the sprite and code areas (which are pre-filled with example code) before the next part.


We begin drawing pictures and implementing the actual game.

Built with AutoSite