Back

Love2d Posts

Colour Flip

posted in Music, Love2d, Game at 12 September 2017

For a game jam hosted by the Guildford Game Jammers at Media Molecule, we made a game called Colour Flip!

look it's colour flip

Made by Kirsty and I, this is a local multiplayer game about capturing a flag without getting flipped onto the wrong colour. Each player can only travel on their colour. Every player has the ability to flip the colours in their row, column, or nearby to make a path they can travel on.

It features team selection, joystick integration (well, works with PS3 controllers for certain), music by me, art by me (as you can tell, I'm not that great at art), level selection (made after the jam by Kirsty) and a bunch of other features which you can find out by playing the game!

Only Connect

posted in Love2d, Hardware at 01 September 2017

Some backstory: one of my teachers at sixth form was an Only Connect contestant who thought that running our own Only Connect would be cool. So, I wrote software and created buzzers for our own version! This was made in February 2015, although at the time of writing this post I'm rewriting some of the code to prove I have improved and do know how to use a for loop.

Only Connect Software

The Software

The application is written LÖVE 2d, a library for making games in Lua, and also the only thing I knew how to make graphical applications in at the time. Whoops. Needless to say, for making GUIs, this is a mistake. But anyway, a few nice things came out of it. This application can run an entire Only Connect show including tiebreakers and can be controlled with just your keyboard rather than fancy special hardware (more on that later). It features nice animations, a way to read sets of questions from file and a host console that tells the host what the scores are and who should go next (which is just a bunch of print statements to console, nothing special there).

Animations

The animations are done by defining linear tweens that can be used throughout the code. A tween is stored as a Lua table containing its start value, end value, length and how much time has elapsed. When updated with updateTween(tween), this internal count of how much time has elapsed is updated. When getting the current value of the tween with val(tween), it just does start + (end-start)*(time/total_time), as you would expect from a linear transition.

These are used throughout the program to make things glide across the screen rather than teleport. It is also used to fade between colours, for example when a hieroglyph is selected, it fades to and from the new colour with three tweens - red, green and blue value.

Reading Questions from File

| round 2
Toy Story Movies~Toy Story;Toy Story 2;Toy Story 3;Toy Story 4 (Coming Soon!)
Rainbow~Red;Orange;Yellow;Green
Composite Numbers~20;21;22;24
*Grades In Some Rythmn Games~C (about 60%);B (about 70%);A (about 80%);S (about 90%+)
Noble Gases~Argon;Krypton;Xenon;Radon
Note Lengths~Crotchet;Minim;Semibreve;Breve
| round 3 #1
Types of Netrunner Card~Operation;Hardware;Program;Resource
Cold~Ice;Snow;Wind;Shoulder
Synonyms for Situation~Problem;Predic -ament;Situation;Event
Gifts~Present;Offering;Sacrifice;Delivery
| round 3 #2
Programming Languages~Go;C;Python;Java
Action Words~Stop;Wait;Run;Hop
Letters~B;A;D;E
Snakes~Cobra;Adder;Anaconda;Milk

Here is part of an Only Connect question file. In importer.lua, we import this as the questions by putting them in the relevant Lua tables and splitting up the clues. The format is pretty simple: | starts a comment, ~ splits a question and answer and ; separates answers. We also have * and $ prefixes which mark the picture and music rounds respectively, which look for the pictures and music files present in the folder shared with this questions file. The code for converting these is mostly just multiple applications of string.gmatch, so is uninteresting. But the format itself is quite nice.

Actually Displaying Things

This isn't very special, and mostly just involves drawing things at certain positions on screen. It does account for changing the size of the screen, however: a scale variable is defined based on the height of the window, and everything is multiplied by that scale. This meant that everything could be tested at one screen size and would automatically work for others. A second scale variable is also defined that works out how much wider it is, so that even if you just change the width and not the height, the elements will move to centre, such as on a particularly wide screen.

The Hardware

Only Connect Hardware

The hardware, despite looking like a mess of wires, is relatively simple. We have some arcade buttons attached to a MakeyMakey, which converts electrical input into keypresses. There are four total boxes - two with just a single button that acts as a buzzer for each team, one to house the MakeyMakey and one for the host. The host box has three buttons - one to say the team was correct, one to say the team was incorrect and one to move the question on (reveal new clues, move to the next question etc). The MakeyMakey could easily be replaced by an Arduino, but that would require an Arduino capable of simulating keypresses.

You Must Get The Atoms

posted in Game, Love2d, Music at 01 September 2017

You Must Get The Atoms is a puzzle game created in August 2013 during Ludum Dare 48 about collecting atoms, combining them to make compounds and using those to get through the levels (although if you play it you'll be able to tell that I don't have a chemistry background so some of the compounds do weird things, like CO conducts electricity? I think I confused C and Cu). The main mechanic involves swapping atoms you've collected around so they react with each other.

Playing it now I can see that the timer (there's a ten second timer for each level, as the theme of the game jam was "10 seconds") was very much bolted on and makes the game stupidly difficult, but it still includes some nice touches including a level editor, tutorial throughout the game and actual reasonable collision detection. I also did the music for it, which seems to get annoying after a while but I'm still proud of it.

You Must Get The Atoms screenshot

Song Of Sparks

posted in Love2d, Music, Game at 01 September 2017

Song Of Sparks is a game made for Mini Ludum Dare #43 in June 2013. In it, you create and move little sparks which float around the screen away from your cursor to create music. Each spark is an oscillator which plays a higher note the higher up it is on the screen. The sparks play in order from left to right, thus allowing you to create a sort-of melody by moving the sparks around. There's a story too. For this game I created the background music and did the audio programming that allowed the sparks to make the right pitches at the right time.

Song of Sparks