[Concept and WIP] Undertale Pocket Battles

Do you have the unconverted sprite(s)?

It’s hard to find the problem without knowing what the sprites are supposed to look like.

New%20Piskel%20copy%205

It looks like this, but the sprites are arranged vertically instead of horizontally. I’m not at home right now, but ill try to get a better image as well as an example of the corruption as soon as possible. Thank you for helping me!

1 Like

I found the problem and it’s exactly what I expected it would be.
For some reason your images weren’t formatted correctly.

I split the frames up and ran them through my personal image converter and then put the output in your code and it fixed the problem.

So here’s a version of the program that works:

#include <Arduboy2.h>
#include <ArduboyPlaytune.h>
Arduboy2 arduboy;
//variables declared
int gamestate = 0;
int health = 20;
int frame = 0;
const int spriteFrame1 = 0;
const int spriteFrame2 = 1;
const int frameUpdates = 30;
int heartX = 32;
int heartY = 32;

constexpr uint8_t ardumanWidth = 24;
constexpr uint8_t ardumanHeight = 28;

uint8_t const arduman[] PROGMEM =
{
	// Dimensions
	ardumanWidth, ardumanHeight,

	// Frame 0 - Frame0
	0x00, 0x00, 0x00, 0xFF, 0xFD, 0x03, 0x33, 0x33, 0x03, 0x03, 0x23, 0x43, 0x43, 0x23, 0x03, 0x03, 0x33, 0x33, 0x03, 0xFD, 0xFF, 0x00, 0x00, 0x00,
	0x1C, 0x02, 0x01, 0xFF, 0xFF, 0xFC, 0x3C, 0x3C, 0x38, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xF8, 0xFC, 0xFC, 0xFC, 0xFF, 0xFF, 0x01, 0x02, 0x1C,
	0x00, 0x00, 0x00, 0xFF, 0x78, 0xF8, 0xE5, 0xE2, 0xE5, 0xF8, 0xF8, 0xFF, 0xFF, 0xE3, 0xE3, 0xE3, 0xFF, 0xF8, 0xF8, 0x78, 0xFF, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x09, 0x09, 0x0F, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x0F, 0x09, 0x09, 0x00, 0x00, 0x00,

	// Frame 1 - Frame1
	0x00, 0x00, 0x00, 0xFE, 0xFA, 0x06, 0x66, 0x66, 0x06, 0x06, 0x46, 0x86, 0x86, 0x46, 0x06, 0x06, 0x66, 0x66, 0x06, 0xFA, 0xFE, 0x00, 0x00, 0x00,
	0x70, 0x08, 0x04, 0xFF, 0xFF, 0xF8, 0x78, 0x78, 0x70, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF8, 0xF8, 0xF8, 0xFF, 0xFF, 0x04, 0x08, 0x70,
	0x00, 0x00, 0x00, 0xFF, 0xF1, 0xF1, 0xCA, 0xC4, 0xCA, 0xF1, 0xF1, 0xFF, 0xFF, 0xC7, 0xC7, 0xC7, 0xFF, 0xF1, 0xF1, 0xF1, 0xFF, 0x00, 0x00, 0x00,
	0x00, 0x00, 0x00, 0x0B, 0x0A, 0x0F, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x0F, 0x0A, 0x0B, 0x00, 0x00, 0x00,
};



//sprites declared
const unsigned char titleScreen[] PROGMEM = {
  0x00, 0x00, 0xf0, 0xf8, 0xfc, 0x00, 0x80, 0xfc, 0xfc, 0xfc, 0x00, 0x00, 0xfc, 0xfc, 0x7c, 0xf8, 0xf0, 0xf8, 0xfc, 0x00, 0x00, 0xfc, 0xfc, 0x1c, 0xbc, 0xfc, 0xf8, 0xf8, 0x00, 0x00, 0xf8, 0xfc, 0xfc, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0xfc, 0xfc, 0xe4, 0xcc, 0xe4, 0xfc, 0x7c, 0x7c, 0x00, 0x00, 0x18, 0x18, 0x1c, 0xfc, 0xfc, 0xfc, 0x1c, 0x1c, 0x1c, 0x00, 0x00, 0xe0, 0xf8, 0x3c, 0x3c, 0xfc, 0xfc, 0xfc, 0x00, 0x00, 0xf0, 0xf8, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xfc, 0xfc, 0x6c, 0x6c, 0x6c, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xfc, 0xfc, 0xfc, 0xf8, 0xfc, 0xfc, 0xfc, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x87, 0x87, 0x87, 0x87, 0x87, 0x7, 0x7, 0x7, 0x00, 0x80, 0x87, 0x87, 0x80, 0x00, 0x1, 0x3, 0x7, 0x80, 0x80, 0x87, 0x87, 0x7, 0x7, 0x87, 0x87, 0x00, 0x00, 0x80, 0x83, 0x7, 0x7, 0x87, 0x87, 0x87, 0x87, 0x80, 0x80, 0x7, 0x7, 0x80, 0x80, 0x81, 0x87, 0x87, 0x86, 0x80, 0x00, 0x00, 0x00, 0x00, 0x7, 0x87, 0x87, 0x80, 0x80, 0x80, 0x00, 0x00, 0x7, 0x7, 0x81, 0x81, 0x87, 0x7, 0x7, 0x00, 0x80, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0x7, 0x2, 0x80, 0x80, 0x83, 0x87, 0x87, 0x87, 0x87, 0x7, 0x7, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x81, 0x3, 0x7, 0x3, 0x1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0xd, 0xd, 0xf, 0x7, 0x00, 0x00, 0x3f, 0x7f, 0x61, 0x61, 0x7f, 0x3f, 0x00, 0x00, 0x3f, 0x7f, 0x61, 0x61, 0x61, 0x00, 0x00, 0x7f, 0x7f, 0x1e, 0x3f, 0x73, 0x61, 0x00, 0x00, 0x7f, 0x7f, 0x6d, 0x6d, 0x6d, 0x6d, 0x00, 0x00, 0x1, 0x1, 0x7f, 0x7f, 0x1, 0x1, 0x1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x4d, 0x4d, 0x7f, 0x33, 0x00, 0x00, 0x7e, 0x7f, 0x13, 0x7f, 0x7e, 0x00, 0x00, 0x1, 0x1, 0x7f, 0x7f, 0x1, 0x1, 0x1, 0x00, 0x00, 0x1, 0x1, 0x7f, 0x7f, 0x1, 0x1, 0x1, 0x00, 0x00, 0x7f, 0x7f, 0x60, 0x60, 0x60, 0x60, 0x00, 0x00, 0x7f, 0x7f, 0x6d, 0x6d, 0x6d, 0x6d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,  
};


const unsigned char heart[] PROGMEM = {
  0x6, 0xf, 0x1e, 0xf, 0x6, 
};

void setup() {
  // put your setup code here, to run once:
  arduboy.begin();
  arduboy.clear();
  arduboy.setFrameRate(60);
}

void loop() {
  // put your main code here, to run repeatedly:
  if(!arduboy.nextFrame()) {
    return;
  }
  switch(gamestate) {
    case 0:
      //title screen start
      title();
      break;
    case 1:
      //begin game
      game();
      break;
  }
}

void title() {
  arduboy.clear();
  
  arduboy.drawBitmap(0, 0, titleScreen, 128, 32, WHITE);
  arduboy.setCursor(2, 40);
  arduboy.print("PRESS A TO BEGIN");
  arduboy.display();

  if (arduboy.pressed(A_BUTTON)) {
    gamestate++;
  }
}

void game() {
  arduboy.clear();
  updateSprite();
  drawSprite();
  arduboy.print(frame);
  arduboy.drawRect(0, 8, 64, 40, WHITE);
  arduboy.drawBitmap(heartX, heartY, heart, 5, 5, WHITE);
  arduboy.display();

  if (arduboy.pressed(B_BUTTON)) {
    gamestate = 0;
  }
  
  if (arduboy.pressed(RIGHT_BUTTON) && heartX < 58) {
     heartX = heartX + 2;
  }
    
  if (arduboy.pressed(LEFT_BUTTON) && heartX > 2) {
    heartX = heartX - 2;
  }

  if (arduboy.pressed(UP_BUTTON) && heartY > 10) {
    heartY = heartY - 2;
  }

  if (arduboy.pressed(DOWN_BUTTON) && heartY < 42) {
    heartY = heartY + 2;
  }
}

void updateSprite() {
  if (arduboy.everyXFrames(frameUpdates)) {
    
    if (frame < spriteFrame2) {
      frame++;
    } else {
      frame = spriteFrame1;
    }

  }
}

void drawSprite() {
  Sprites::drawOverwrite(90, 10, arduman, frame);
}

No problem.

1 Like

New stuff added! There’s a new title screen, a health meter, and a bouncing test bubble that deals damage.

New%20Piskel%20copy%209

IMG_5080

Thank you pharap for helping with a lot of problems!

2 Likes

well… i broke my arduboy. I dropped it and it won’t turn on anymore. A battery tab is broken and i found out I couldn’t fix it after trying to fix it. Do i have to buy a new one, or do they do replacements?

I believe they are hard to solder (and somewhat dangerous).

Screw up a small ball of silver foil - big enough that the case will hold it in place and screw the case back on. Very low tech but will work.

You should contact support anyway.

1 Like