MANILA FUNCTIONAL

I picked up an Arduboy recently and it’s possibly one of my most favorite platforms right now. It’s the most accessible way to learn how to make games, I’d go as far and say that it’s easier than pico-8.

#include <Arduboy2.h>

// The first two elements are the width and height of the sprites
// Each row afterwards is one frame
// Each element in a row/frame is a row in the screen
const byte PROGMEM player_bitmaps[] =
{
  8, 16,
  0x00, 0x00, 0xc0, 0x20, 0xf0, 0xfe, 0xf6, 0xe0, 0x00, 0x00, 0x03, 0x04, 0xff, 0x03, 0xff, 0x07, // R still
  0x00, 0x00, 0xe0, 0x10, 0xf8, 0xff, 0xfb, 0xf0, 0x00, 0x20, 0x21, 0x22, 0x1f, 0x01, 0xff, 0x03, // R walk 1
  0x00, 0x00, 0xc0, 0x20, 0xf0, 0xfe, 0xf6, 0xe0, 0x00, 0x00, 0x03, 0x24, 0xff, 0x23, 0x1f, 0x07, // R walk 2

  0x00, 0xe0, 0xf6, 0xfe, 0xf0, 0x20, 0xc0, 0x00, 0x00, 0x07, 0xff, 0x03, 0xff, 0x04, 0x03, 0x00,
  0x00, 0xf0, 0xfb, 0xff, 0xf8, 0x10, 0xe0, 0x00, 0x00, 0x03, 0xff, 0x01, 0x1f, 0x22, 0x21, 0x20,
  0x00, 0xe0, 0xf6, 0xfe, 0xf0, 0x20, 0xc0, 0x00, 0x00, 0x07, 0x1f, 0x23, 0xff, 0x24, 0x03, 0x00,
};

Arduboy2 arduboy;
Sprites sprites;
byte frame = 0;

void setup()
{
  arduboy.begin();
  arduboy.clear();
  // Limits the frame rate to 30
  arduboy.setFrameRate(30);
}

void loop() {
  // This gates the framerate as set in .setFrameRate above
  if (!(arduboy.nextFrame())) return;
  arduboy.clear();
  // This draws the sprite onto the screen
  sprites.drawSelfMasked(0, 0, player_bitmaps, frame);
  // Indexes the next sprite every 3 frames, reset when 3
  if (arduboy.everyXFrames(3)) frame++;
  if (frame > 2) frame = 0;
  arduboy.display();
}