Creating a simple sprite animation on an Arduboy

Hi all,
Currently got 205 students creating, splash screens and sprites for Arduboy. The students love the arduboy (clone) and are very thankful for the community support. Their current project is pixel art based to create their own character based on either a new or existing arduboy game. My coding ability is very very poor. So far I have managed to create a moving sprite but would love to know how to create an animated sprite, like one running or stationary with a tapping foot. I assume this would incorporate switch case, 0-9, showing each image in turn. I found this code using a different library system but not sure how to convert to an Arduboy friendly version. Any support would be really appreciated. See code:

//Author : Sandhan Sarma <sandhan.sarma26@gmail.com>
//Date   : 16th December 2018

#include<Arduino.h>
#include<U8g2lib.h>
#include<Wire.h>


U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);

// Copy the contents of your .xbm file below

#define skeletor_width 64
#define skeletor_height 64
const static unsigned char skeletor_bits[4][512] PROGMEM = {
  {
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0,
    0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x0e, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0xc6, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xf9,
    0xcf, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xfe, 0xbf, 0x01, 0x00, 0x00,
    0x00, 0x00, 0x20, 0xff, 0x7f, 0x02, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xff,
    0xff, 0x06, 0x00, 0x00, 0x00, 0x00, 0xc8, 0xff, 0xff, 0x09, 0x00, 0x00,
    0x00, 0x00, 0x24, 0xfe, 0x3f, 0x12, 0x00, 0x00, 0x00, 0x00, 0xf6, 0xfd,
    0xdf, 0x37, 0x00, 0x00, 0x00, 0x00, 0xda, 0xfb, 0xef, 0x2d, 0x00, 0x00,
    0x00, 0x00, 0x8d, 0xff, 0xff, 0x58, 0x00, 0x00, 0x00, 0x80, 0x05, 0xfe,
    0x3f, 0xd0, 0x00, 0x00, 0x00, 0x80, 0x05, 0x30, 0x06, 0xd0, 0x00, 0x00,
    0x00, 0x80, 0x05, 0x90, 0x04, 0xd0, 0x00, 0x00, 0x00, 0xc0, 0x05, 0xc8,
    0x09, 0xd0, 0x01, 0x00, 0x00, 0xc0, 0x06, 0xce, 0x39, 0xb0, 0x01, 0x00,
    0x00, 0xe0, 0xfa, 0xff, 0xff, 0xaf, 0x03, 0x00, 0x00, 0xe0, 0xfe, 0xfe,
    0xbf, 0xbf, 0x03, 0x00, 0x00, 0x70, 0x7f, 0xff, 0x7f, 0x7f, 0x07, 0x00,
    0x00, 0x70, 0xbf, 0x5f, 0xfd, 0x7e, 0x07, 0x00, 0x00, 0x70, 0xbf, 0x6f,
    0xfb, 0x7e, 0x07, 0x00, 0x00, 0x78, 0xcf, 0x6b, 0xeb, 0x79, 0x0f, 0x00,
    0x00, 0x78, 0x4f, 0x6d, 0x5b, 0x79, 0x0f, 0x00, 0x00, 0x38, 0x86, 0x0d,
    0xd8, 0x30, 0x0e, 0x00, 0x00, 0x3c, 0x82, 0x00, 0x80, 0x20, 0x1e, 0x00,
    0x00, 0x3c, 0x10, 0x00, 0x00, 0x04, 0x1e, 0x00, 0x00, 0x3c, 0x18, 0x60,
    0x03, 0x0c, 0x1e, 0x00, 0x00, 0x3c, 0x3c, 0x6c, 0x1b, 0x1e, 0x1e, 0x00,
    0x00, 0x3c, 0x3c, 0x5c, 0x1d, 0x1e, 0x1e, 0x00, 0x00, 0x3e, 0x3c, 0xf7,
    0x77, 0x1e, 0x3e, 0x00, 0x00, 0x3e, 0x3c, 0xfd, 0x5f, 0x1e, 0x3e, 0x00,
    0x00, 0x3e, 0x78, 0xfe, 0x3f, 0x0f, 0x3e, 0x00, 0x00, 0x3e, 0xf8, 0xff,
    0xff, 0x0f, 0x3e, 0x00, 0x00, 0x3e, 0xf8, 0xff, 0xff, 0x0f, 0x3e, 0x00,
    0x00, 0x3f, 0xf8, 0xff, 0xff, 0x0f, 0x7e, 0x00, 0x00, 0x3f, 0xf8, 0x1f,
    0xfc, 0x0f, 0x7e, 0x00, 0x00, 0x3f, 0xf8, 0x07, 0xf0, 0x0f, 0x7e, 0x00,
    0x00, 0x3f, 0xf8, 0x01, 0xc0, 0x0f, 0x7e, 0x00, 0x00, 0x3f, 0xf0, 0x00,
    0x80, 0x07, 0x7e, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00,
    0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x3f, 0x00, 0x00,
    0x00, 0x00, 0x7e, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00,
    0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x7f, 0x00, 0x00,
    0x00, 0x00, 0x7f, 0x00, 0x80, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff, 0x00,
    0x80, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff, 0x00, 0x80, 0xff, 0x01, 0x00,
    0x00, 0xc0, 0xff, 0x00, 0xc0, 0xff, 0x03, 0x00, 0x00, 0xe0, 0xff, 0x01,
    0xe0, 0xff, 0x07, 0x00, 0x00, 0xf0, 0xff, 0x03, 0xe0, 0xff, 0x0f, 0x00,
    0x00, 0xf8, 0xff, 0x03, 0xf8, 0xff, 0x1f, 0x00, 0x00, 0xfc, 0xff, 0x0f,
    0xf8, 0xff, 0x3f, 0x00, 0x00, 0xfe, 0xff, 0x0f, 0x00, 0xfc, 0xff, 0x00,
    0x80, 0xff, 0x1f, 0x00, 0x00, 0xe0, 0xff, 0x03, 0xe0, 0xff, 0x03, 0x00,
    0x00, 0xc0, 0xff, 0x0f, 0xf8, 0xff, 0x01, 0x00, 0x00, 0x00, 0xfe, 0x3f,
    0xfe, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x1f, 0x00, 0x00,
    0x00, 0x00, 0xf0, 0x0f, 0xf8, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
    0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  },
  {
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0,
    0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x0e, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0xc6, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xf9,
    0xcf, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xfe, 0xbf, 0x01, 0x00, 0x00,
    0x00, 0x00, 0x20, 0xff, 0x7f, 0x02, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xff,
    0xff, 0x06, 0x00, 0x00, 0x00, 0x00, 0xc8, 0xff, 0xff, 0x09, 0x00, 0x00,
    0x00, 0x00, 0x24, 0xfe, 0x3f, 0x12, 0x00, 0x00, 0x00, 0x00, 0xf6, 0xfd,
    0xdf, 0x37, 0x00, 0x00, 0x00, 0x00, 0xda, 0xfb, 0xef, 0x2d, 0x00, 0x00,
    0x00, 0x00, 0x8d, 0xff, 0xff, 0x58, 0x00, 0x00, 0x00, 0x80, 0x05, 0xfe,
    0x3f, 0xd0, 0x00, 0x00, 0x00, 0x80, 0x05, 0x30, 0x06, 0xd0, 0x00, 0x00,
    0x00, 0x80, 0x05, 0x90, 0x04, 0xd0, 0x00, 0x00, 0x00, 0xc0, 0x05, 0xc8,
    0x09, 0xd0, 0x01, 0x00, 0x00, 0xc0, 0x06, 0xce, 0x39, 0xb0, 0x01, 0x00,
    0x00, 0xe0, 0xfa, 0xff, 0xff, 0xaf, 0x03, 0x00, 0x00, 0xe0, 0xfe, 0xfe,
    0xbf, 0xbf, 0x03, 0x00, 0x00, 0x70, 0x7f, 0xff, 0x7f, 0x7f, 0x07, 0x00,
    0x00, 0x70, 0xbf, 0x5f, 0xfd, 0x7e, 0x07, 0x00, 0x00, 0x70, 0xbf, 0x6f,
    0xfb, 0x7e, 0x07, 0x00, 0x00, 0x78, 0xcf, 0x6b, 0xeb, 0x79, 0x0f, 0x00,
    0x00, 0x78, 0x4f, 0x6d, 0x5b, 0x79, 0x0f, 0x00, 0x00, 0x38, 0x86, 0x0d,
    0xd8, 0x30, 0x0e, 0x00, 0x00, 0x3c, 0x82, 0x00, 0x80, 0x20, 0x1e, 0x00,
    0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x3c, 0x00, 0x00,
    0x00, 0x00, 0x1e, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00,
    0x00, 0x3c, 0x10, 0x00, 0x00, 0x04, 0x1e, 0x00, 0x00, 0x3e, 0x18, 0x60,
    0x03, 0x0c, 0x3e, 0x00, 0x00, 0x3e, 0x3c, 0x6c, 0x1b, 0x1e, 0x3e, 0x00,
    0x00, 0x3e, 0x3c, 0x5c, 0x1d, 0x1e, 0x3e, 0x00, 0x00, 0x3e, 0x3c, 0xf7,
    0x77, 0x1e, 0x3e, 0x00, 0x00, 0x3e, 0x3c, 0xfd, 0x5f, 0x1e, 0x3e, 0x00,
    0x00, 0x3f, 0x78, 0xfe, 0x3f, 0x0f, 0x7e, 0x00, 0x00, 0x3f, 0xf8, 0xff,
    0xff, 0x0f, 0x7e, 0x00, 0x00, 0x3f, 0xf8, 0xff, 0xff, 0x0f, 0x7e, 0x00,
    0x00, 0x3f, 0xf8, 0xff, 0xff, 0x0f, 0x7e, 0x00, 0x00, 0x3f, 0xf8, 0x1f,
    0xfc, 0x0f, 0x7e, 0x00, 0x00, 0x3f, 0xf8, 0x07, 0xf0, 0x0f, 0x7e, 0x00,
    0x00, 0x3f, 0xf8, 0x01, 0xc0, 0x0f, 0x7e, 0x00, 0x00, 0x3f, 0xf0, 0x00,
    0x80, 0x07, 0x7e, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00,
    0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x7f, 0x00, 0x00,
    0x00, 0x00, 0x7f, 0x00, 0x80, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff, 0x00,
    0x80, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff, 0x00, 0x80, 0xff, 0x01, 0x00,
    0x00, 0xc0, 0xff, 0x00, 0xc0, 0xff, 0x03, 0x00, 0x00, 0xe0, 0xff, 0x01,
    0xe0, 0xff, 0x07, 0x00, 0x00, 0xf0, 0xff, 0x03, 0xe0, 0xff, 0x0f, 0x00,
    0x00, 0xf8, 0xff, 0x03, 0xf8, 0xff, 0x1f, 0x00, 0x00, 0xfc, 0xff, 0x0f,
    0xf8, 0xff, 0x3f, 0x00, 0x00, 0xfe, 0xff, 0x0f, 0x00, 0xfc, 0xff, 0x00,
    0x80, 0xff, 0x1f, 0x00, 0x00, 0xe0, 0xff, 0x03, 0xe0, 0xff, 0x03, 0x00,
    0x00, 0xc0, 0xff, 0x0f, 0xf8, 0xff, 0x01, 0x00, 0x00, 0x00, 0xfe, 0x3f,
    0xfe, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x1f, 0x00, 0x00,
    0x00, 0x00, 0xf0, 0x0f, 0xf8, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
    0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  },
  {
    0x00, 0x00, 0x00, 0x3c, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3,
    0xe3, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xfc, 0x1f, 0x03, 0x00, 0x00,
    0x00, 0x00, 0x30, 0xff, 0xff, 0x06, 0x00, 0x00, 0x00, 0x00, 0x30, 0xff,
    0xff, 0x06, 0x00, 0x00, 0x00, 0x00, 0xc8, 0xff, 0xff, 0x19, 0x00, 0x00,
    0x00, 0x00, 0xec, 0xff, 0xff, 0x3b, 0x00, 0x00, 0x00, 0x00, 0xf3, 0xff,
    0xff, 0x47, 0x00, 0x00, 0x00, 0x80, 0x08, 0xff, 0xff, 0x88, 0x00, 0x00,
    0x00, 0x80, 0x08, 0xff, 0xff, 0x88, 0x00, 0x00, 0x00, 0xc0, 0xfc, 0xfe,
    0x3f, 0xbf, 0x01, 0x00, 0x00, 0x40, 0xf6, 0xfd, 0xdf, 0x77, 0x01, 0x00,
    0x00, 0xa0, 0xe3, 0xff, 0xff, 0xe3, 0x02, 0x00, 0x00, 0xb0, 0x01, 0xff,
    0x7f, 0x80, 0x06, 0x00, 0x00, 0xb0, 0x01, 0x38, 0x0e, 0x80, 0x06, 0x00,
    0x00, 0x30, 0x01, 0x38, 0x0e, 0x80, 0x06, 0x00, 0x00, 0x30, 0x01, 0x98,
    0x08, 0xc0, 0x06, 0x00, 0x00, 0x38, 0x01, 0xc4, 0x11, 0xc0, 0x0e, 0x00,
    0x00, 0xd8, 0x01, 0xc7, 0x71, 0xc0, 0x0d, 0x00, 0x00, 0x9c, 0xfe, 0xff,
    0xff, 0xbf, 0x1d, 0x00, 0x00, 0x9c, 0x7f, 0xff, 0x7f, 0xff, 0x1d, 0x00,
    0x00, 0xee, 0xbf, 0xff, 0xff, 0xfc, 0x3b, 0x00, 0x00, 0xce, 0xbf, 0xff,
    0xff, 0xfc, 0x3b, 0x00, 0x00, 0xce, 0xdf, 0x5f, 0xfd, 0xf9, 0x3b, 0x00,
    0x00, 0xde, 0xdf, 0x6b, 0xeb, 0xf9, 0x3b, 0x00, 0x00, 0xdf, 0xe3, 0x6d,
    0xdb, 0xe7, 0x79, 0x00, 0x00, 0xdf, 0xa3, 0x6e, 0xbb, 0xe6, 0x79, 0x00,
    0x00, 0x8f, 0xc1, 0x06, 0xb0, 0xc1, 0x70, 0x00, 0x80, 0x8f, 0x40, 0x00,
    0x00, 0x81, 0xf0, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00,
    0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x80, 0x0f, 0x00, 0x00,
    0x00, 0x00, 0xf8, 0x00, 0x80, 0x0f, 0x08, 0x00, 0x00, 0x18, 0xf8, 0x00,
    0xc0, 0x0f, 0x0c, 0x60, 0x03, 0x38, 0xf8, 0x01, 0xc0, 0x0f, 0x1f, 0x6c,
    0x1b, 0x7c, 0xf8, 0x01, 0x80, 0x0f, 0x1e, 0x5e, 0x3d, 0x7c, 0xf8, 0x01,
    0x80, 0x0f, 0x9e, 0xf7, 0xef, 0x7c, 0xf8, 0x01, 0x80, 0x0f, 0x9e, 0xfe,
    0xbf, 0x3c, 0xf8, 0x00, 0xc0, 0x0f, 0x3c, 0xff, 0x7f, 0x1e, 0xf8, 0x01,
    0xc0, 0x0f, 0xfc, 0xff, 0xff, 0x1f, 0xf8, 0x01, 0xc0, 0x0f, 0xfc, 0xff,
    0xff, 0x1f, 0xf8, 0x01, 0xc0, 0x0f, 0xfc, 0xff, 0xff, 0x1f, 0xf8, 0x01,
    0xc0, 0x1f, 0xfc, 0x1f, 0xfc, 0x1f, 0xf8, 0x01, 0xc0, 0x1f, 0xfc, 0x07,
    0xf0, 0x1f, 0xfc, 0x01, 0xc0, 0x1f, 0xfc, 0x01, 0x80, 0x1f, 0xfc, 0x01,
    0xc0, 0x1f, 0xf8, 0x00, 0x00, 0x0f, 0xfc, 0x01, 0xc0, 0x1f, 0x00, 0x00,
    0x00, 0x00, 0xfc, 0x01, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x01,
    0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0xc0, 0x7f, 0x00, 0x00,
    0x00, 0x00, 0xff, 0x01, 0xc0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xff, 0x01,
    0xc0, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff, 0x01, 0xe0, 0xff, 0x01, 0x00,
    0x00, 0xc0, 0xff, 0x03, 0xf0, 0xff, 0x07, 0x00, 0x00, 0xe0, 0xff, 0x07,
    0xf0, 0xff, 0x0f, 0x00, 0x00, 0xf8, 0xff, 0x07, 0xfc, 0xff, 0x3f, 0x00,
    0x00, 0xfe, 0xff, 0x1f, 0x00, 0xfe, 0xff, 0x00, 0x80, 0xff, 0x3f, 0x00,
    0x00, 0xe0, 0xff, 0x03, 0xe0, 0xff, 0x07, 0x00, 0x00, 0xc0, 0xff, 0x0f,
    0xf8, 0xff, 0x01, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x00,
    0x00, 0x00, 0xfc, 0x07, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
    0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  },
  {
    0x00, 0x00, 0x00, 0x3c, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc3,
    0xe3, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xfc, 0x1f, 0x03, 0x00, 0x00,
    0x00, 0x00, 0x30, 0xff, 0xff, 0x06, 0x00, 0x00, 0x00, 0x00, 0x30, 0xff,
    0xff, 0x06, 0x00, 0x00, 0x00, 0x00, 0xc8, 0xff, 0xff, 0x19, 0x00, 0x00,
    0x00, 0x00, 0xec, 0xff, 0xff, 0x3b, 0x00, 0x00, 0x00, 0x00, 0xf3, 0xff,
    0xff, 0x47, 0x00, 0x00, 0x00, 0x80, 0x08, 0xff, 0xff, 0x88, 0x00, 0x00,
    0x00, 0x80, 0x08, 0xff, 0xff, 0x88, 0x00, 0x00, 0x00, 0xc0, 0xfc, 0xfe,
    0x3f, 0xbf, 0x01, 0x00, 0x00, 0x40, 0xf6, 0xfd, 0xdf, 0x77, 0x01, 0x00,
    0x00, 0xa0, 0xe3, 0xff, 0xff, 0xe3, 0x02, 0x00, 0x00, 0xb0, 0x01, 0xff,
    0x7f, 0x80, 0x06, 0x00, 0x00, 0xb0, 0x01, 0x38, 0x0e, 0x80, 0x06, 0x00,
    0x00, 0x30, 0x01, 0x38, 0x0e, 0x80, 0x06, 0x00, 0x00, 0x30, 0x01, 0x98,
    0x08, 0xc0, 0x06, 0x00, 0x00, 0x38, 0x01, 0xc4, 0x11, 0xc0, 0x0e, 0x00,
    0x00, 0xd8, 0x01, 0xc7, 0x71, 0xc0, 0x0d, 0x00, 0x00, 0x9c, 0xfe, 0xff,
    0xff, 0xbf, 0x1d, 0x00, 0x00, 0x9c, 0x7f, 0xff, 0x7f, 0xff, 0x1d, 0x00,
    0x00, 0xee, 0xbf, 0xff, 0xff, 0xfc, 0x3b, 0x00, 0x00, 0xce, 0xbf, 0xff,
    0xff, 0xfc, 0x3b, 0x00, 0x00, 0xce, 0xdf, 0x5f, 0xfd, 0xf9, 0x3b, 0x00,
    0x00, 0xde, 0xdf, 0x6b, 0xeb, 0xf9, 0x3b, 0x00, 0x00, 0xdf, 0xe3, 0x6d,
    0xdb, 0xe7, 0x79, 0x00, 0x00, 0xdf, 0xa3, 0x6e, 0xbb, 0xe6, 0x79, 0x00,
    0x00, 0x8f, 0xc1, 0x06, 0xb0, 0xc1, 0x70, 0x00, 0x80, 0x8f, 0x40, 0x00,
    0x00, 0x81, 0xf0, 0x00, 0x80, 0x0f, 0x08, 0x00, 0x00, 0x18, 0xf8, 0x00,
    0x80, 0x0f, 0x0c, 0x60, 0x03, 0x38, 0xf8, 0x00, 0x80, 0x0f, 0x1f, 0x6c,
    0x1b, 0x7c, 0xf8, 0x00, 0x80, 0x0f, 0x1e, 0x5e, 0x3d, 0x7c, 0xf8, 0x00,
    0xc0, 0x0f, 0x9e, 0xf7, 0xef, 0x7c, 0xf8, 0x01, 0xc0, 0x0f, 0x9e, 0xfe,
    0xbf, 0x3c, 0xf8, 0x01, 0x80, 0x0f, 0x3c, 0xff, 0x7f, 0x1e, 0xf8, 0x01,
    0x80, 0x0f, 0xfc, 0xff, 0xff, 0x1f, 0xf8, 0x01, 0x80, 0x0f, 0xfc, 0xff,
    0xff, 0x1f, 0xf8, 0x00, 0xc0, 0x0f, 0xfc, 0xff, 0xff, 0x1f, 0xf8, 0x01,
    0xc0, 0x0f, 0xfc, 0x1f, 0xfc, 0x1f, 0xf8, 0x01, 0xc0, 0x0f, 0xfc, 0x07,
    0xf0, 0x1f, 0xf8, 0x01, 0xc0, 0x0f, 0xfc, 0x01, 0x80, 0x1f, 0xf8, 0x01,
    0xc0, 0x1f, 0xf8, 0x00, 0x00, 0x0f, 0xf8, 0x01, 0xc0, 0x1f, 0x00, 0x00,
    0x00, 0x00, 0xfc, 0x01, 0xc0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x01,
    0xc0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x01, 0xc0, 0x1f, 0x00, 0x00,
    0x00, 0x00, 0xfc, 0x01, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x01,
    0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x00, 0xc0, 0x7f, 0x00, 0x00,
    0x00, 0x00, 0xff, 0x01, 0xc0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xff, 0x01,
    0xc0, 0xff, 0x00, 0x00, 0x00, 0x80, 0xff, 0x01, 0xe0, 0xff, 0x01, 0x00,
    0x00, 0xc0, 0xff, 0x03, 0xf0, 0xff, 0x07, 0x00, 0x00, 0xe0, 0xff, 0x07,
    0xf0, 0xff, 0x0f, 0x00, 0x00, 0xf8, 0xff, 0x07, 0xfc, 0xff, 0x3f, 0x00,
    0x00, 0xfe, 0xff, 0x1f, 0x00, 0xfe, 0xff, 0x00, 0x80, 0xff, 0x3f, 0x00,
    0x00, 0xe0, 0xff, 0x03, 0xe0, 0xff, 0x07, 0x00, 0x00, 0xc0, 0xff, 0x0f,
    0xf8, 0xff, 0x01, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x3f, 0x00, 0x00,
    0x00, 0x00, 0xfc, 0x07, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
    0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  }
};

void draw(void) {
  // graphic commands to redraw the complete screen should be placed here
  static uint8_t frame = 0 ;

  switch(frame){
    case 0: u8g2.drawXBMP( 32, 0, skeletor_width, skeletor_height, skeletor_bits[0]);break;
    case 1: u8g2.drawXBMP( 32, 0, skeletor_width, skeletor_height, skeletor_bits[1]);break;
    case 2: u8g2.drawXBMP( 32, 0, skeletor_width, skeletor_height, skeletor_bits[0]);break;
    case 3: u8g2.drawXBMP( 32, 0, skeletor_width, skeletor_height, skeletor_bits[1]);break;
    case 4: u8g2.drawXBMP( 32, 0, skeletor_width, skeletor_height, skeletor_bits[2]);break;
    case 5: u8g2.drawXBMP( 32, 0, skeletor_width, skeletor_height, skeletor_bits[3]);break;
    case 6: u8g2.drawXBMP( 32, 0, skeletor_width, skeletor_height, skeletor_bits[2]);break;
    case 7: u8g2.drawXBMP( 32, 0, skeletor_width, skeletor_height, skeletor_bits[3]);break;
    case 8: u8g2.drawXBMP( 32, 0, skeletor_width, skeletor_height, skeletor_bits[2]);break;
    case 9: u8g2.drawXBMP( 32, 0, skeletor_width, skeletor_height, skeletor_bits[1]);break;
  }
  frame++;

  if(frame>9){
    frame = 0;
  }
}

void setup(void) {
  u8g2.begin();
}

void loop(void) {
  // picture loop
  u8g2.firstPage();
  do {
    draw();
  } while ( u8g2.nextPage() );

  // rebuild the picture after some delay
  delay(70);
}

It depends which library you use.

The Sprites/SpritesB library is probably the easiest if your sprites are all the same size because the last parameter of the function is a frame number.

That kind of thing would probably require a basic state system to govern what state the character should be in.
If you don’t know about them, state machines (or more formally ‘finite state machines’) are a kind of construct often used in programming.
There used in everything from AI to controlling the transition between titlescreen and gameplay.

In diagram form they tend to look like this:

In code form there are many ways of implementing them.
(One way is to use a switch statement.)

As I mentioned before, if you use Sprites or SpritesB then you can just use the last parameter (the ‘frame index’) to specify the sprite frame to be drawn rather than needing a switch.

But even if you used arduboy.drawBitmap you could store your image frames in an array and index the array instead of using a switch.

If there’s no licence then you might not even be allowed to use the code.
But even if you knew the licence, those libraries are different to the ones we tend to use for Arduboy code.


When I have chance I’ll provide a more concrete demonstration,
but until then here’s some relevant comments from past threads asking the same question:

1 Like

This is fantastic, such great feedback. Thank you kindly for taking the time to explain. I will try these examples, read more into this and get back to you.
I’d really like to try and make it as easy as possible but using the arduboy libraries to expose students to the library functions as much as possible. I’d desperately tried to get our computer science team involved but it’s just not happening:(
Mean while if you do manage to get an example, that would be phenomenal.

1 Like

The linked to articles all have enough information to piece together a working example,
but as only one of them has an actual standalone example,
I’ve made a complete example using the rabbit sprites.

In fact I’ve made a handful of examples, which I shall hopefully add to over time:

So far I’ve added just two examples,
but I might add some more as I get chance.
In particular I’d like to add one of the rabbit moving around the screen when the user presses the buttons.

Please make sure to read the README.md.

(If anyone would care to donate some more interesting and/or larger sprites then I’d be happy to replace my tiny rabbits with those.)

2 Likes

Superb and thanks again. I’ll get on this tomorrow first thing and feedback. Thanks again for all your hardwork and prompt responses. It’s what makes this community so good.

1 Like

Moving sprite.hex (22.9 KB)

1 Like

Wow, seems such a basic achievement but I am at home hi fiving myself. The sprite now moves in a range of directions so now I want to create a maze it needs to go through. Hmm! I’ll make it a lot smaller as well!!! I think the students and I will learn a lot from this!!! Small steps :smile:

4 Likes

Unfortunately that can get tricky.
Collisions are surprisingly difficult to get working without any weird bugs or quirks.
It’s certainly doable, but it’s easier to get wrong than to get right.

It’s probably best to tackle making the character face 4 directions first.
(I.e. changing the frame drawn based on which direction the character is travelling.)

As you say, small steps.

Thanks for the feedback. Perhaps micro steps for me then :slight_smile:.

1 Like