KeyKat - I.T. Turn the computers off and back on again!

(Robert Lowe) #1


KeyKat-I.T. Is a game where you are an I.T. worker named KeyKat. She has to run around and turn computers off and back on again when they fail. It’s a fairly simple whack-a-mole type game which I wrote over a period of two weeks.

This is my first complete arduboy game, and I wrote it as a gift for the Reddit Secret Santa exchange. (KeyKat is the screen name of my recipient.) She has received the game, and so now I am sharing it with the Arduboy community.

You can download the game from github:

(Celine) #2

All these cat games makes me so happy

(Scott) #3

The Arduboy library is no longer being maintained and is not recommended for new development. I suggest you switch to using the Arduboy2 and ArduboyPlaytune libraries. One benefit of this is that users will be able to toggle the sound on and off using the built-in Audio Mute Control facility.

Doing this is relatively easy with the current version of keykat-it.ino.

  • Change the #include and instance from Arduboy to Arduboy2.
  • Add a #include and instance for ArduboyPlaytune.
  • Add initialisation of the ArduboyPlaytune instance.
  • Change calls to functions to ArduboyPlaytune tunes functions.

The following is a unified diff for the changes required. It can be applied using a Unix patch compatible program or just used as a reference to make the changes manually.

--- org/keykat-it.ino	2017-12-13 23:53:23.000000000 -0500
+++ new/keykat-it.ino	2017-12-18 08:43:43.239789008 -0500
@@ -15,9 +15,11 @@
     You should have received a copy of the GNU General Public License
     along with this program.  If not, see <>.
-#include <Arduboy.h>
+#include <Arduboy2.h>
+#include <ArduboyPlaytune.h>
 #include "assets.h"
-Arduboy arduboy;
+Arduboy2 arduboy;
+ArduboyPlaytune tunes(;
 //button state global
 bool btnup;
@@ -96,6 +98,18 @@
 void setup() {
+  // audio setup
+  tunes.initChannel(PIN_SPEAKER_1);
+#ifndef AB_DEVKIT
+  // if not a DevKit
+  tunes.initChannel(PIN_SPEAKER_2);
+  // if it's a DevKit
+  tunes.initChannel(PIN_SPEAKER_1); // use the same pin for both channels
+  tunes.toneMutesScore(true);       // mute the score when a tone is sounding
@@ -386,7 +400,7 @@
   //determine how long the computer will work
   comp.ttf = random(minttf, maxttf);
+  tunes.playScore(snd_on);
@@ -403,7 +417,7 @@
   //turn the machine off
   comp.state = OFF;
   comp.s = computer_off;
+  tunes.playScore(snd_off);
@@ -415,7 +429,7 @@
   //break the machine
   comp.state = BROKEN;
   comp.s = computer_broken;
+  tunes.playScore(snd_fail);

(Robert Lowe) #4

Thanks for the heads up! I am new to arduboy’s libraries, and I must have followed an outdated guide for installing them. From there I just read the arduboy source to work out how to use it all. I have applied your patch and pushed the changes to github.

(Felipe Manga) #5

Fun game! :slight_smile:

ArduboyRecording (7b)

(Robert Lowe) #6

Thanks! How did you make that awesome animation?

(Pharap) #7

I’m guessing using ProjectABE and some kind of gif recording software.

(Pharap) #8

Psst, my fixed points library has a secret, nya.

(Felipe Manga) #9

Close! ProjectABE has GIF-recording built-in. Just press R! :wink:

(Scott) #10

It’s annoying to have to power off and on to start a new game. I’ve forked the game and created a pull request that allows a new game to be started.

I also removed the unnecessary function prototypes and used the F() macro to put printed strings into program memory.

(Robert Lowe) #11

Thanks! I merged your pull request just now. I agree, I should have provided for restarting the game. Also, I’m prone to forget about F() (until memory gets scarce). I also forget that I don’t need function prototypes in most situations under arduino. It’s definitely much cleaner now.


This make me think of burning the bootloader on 10 or some similar amount of Arduboy with USB ISPs