GitHub Arduboy RPG!

I am creating an RPG, sort of like EBF, for Arduboy!

Now, because I am just a beginner, a newbie to C++, I don’t know much or how to really get stuff done. So feel free to contribute to the project, because I need it honestly! :grin:

Here is the link to the GitHub page:

I hope that we collectively can get this done!



So now let’s break all the big parts into small pieces :slight_smile:

What is the first problem you would like to tackle ?

1 Like

Can we work with orginization first? With every other language I’ve used, that seems to help the most and it makes fixing things easier.

1 Like

Here as a real first problem let’s go with the animation. how can I tackle that?

##C/C++ Programming
Software Design Tips: Getting Started Using Arduboy

Provided here are some ideas on getting started in designing, documenting and programming a project in C/C++. The Arduboy library is used to provide source for examples.

Using Header Files to Design

The C/C++ language provides a pretty convenient way to flesh out your program via the use of header files and comments.

More information on header files and software design.

Before implementing a function, we will usually want to start by creating definitions for the functions our program will use in a header file.

In a comment block above a function definition, you will often see developers describe the parameters of the function and how the function is expected to behave.

You can find examples of what a “documenting comment block” looks like in the Arduboy library header files. A part of the Arduboy classes header file, Arduoby.h, has been provided below. In the provided source you can find the definition of the drawCircle function from the Arduboy library.

The drawCircle function has a simple and descriptive comment above its definition. Anyone reading the comment can quickly understand what the drawCircle will do and how it should be used.

Keep in mind that a header file does not typically implement the source of function, it simply defines that a function exists for your program. Any function given a definition in a header file must be implemented at some point in your project for the implementation of your program defined in your header be complete and successfully compile.

Arduboy.h -

  /// Draw a circle of a defined radius.
   * Draws a circle in white or black. X and Y are the center point of the circle.
  void drawCircle(int16_t x0, int16_t y0, uint8_t r, uint8_t color);

the source for a function is typical found in a source file, like Arduboy.ccp.

Arduboy.cpp -

void Arduboy::drawCircle(int16_t x0, int16_t y0, uint8_t r, uint8_t color)
  int16_t f = 1 - r;
  int16_t ddF_x = 1;



It is a helpful and common technique to use the creation process of your header files as an opportunity to think about and document your software’s features and functionality.

Before you start writing any source for the definition you provide in your header files, take the time to write out a description of how the function is expected to behave, list out the functions parameters, providing an explanation of each parameter’s use and if anything is returned by the function, provide a description of what is returned.

Taking the time to write out the behavior of yours software gives you a great chance to work through the operation of your program and avoid working on implementing a function you discover you don’t want.

Generating Documentation from Source Files

The comments you generate in your header files can later be used by a program like Doxygen to create documents for your users or developers.

More in Depth and Automation with UML

If you really want to take your program’s design seriously and produce a document that can serve as a road map for you or a team and even to generate code, check out some online flowchart creators, specifically those generating UML, which can be used to generate source code for your software and can be used to template software or rapidly customize your program.

I’ve used Giffy to create flowcharts as a group, and it works pretty well. This flowchart was created in Giffy as a team project I believe.

More information on generating code from UML.

organization: Do you mean … intro, menu, game, pause, game-over ?


Well when using the arduboy lib, the drawBitmap function doesn’t have a frame counter. So you have to do that on your own:

You make a bitmap for every frame you have, then you make an array of all the frames you have:

// this is the first little sprite
const unsigned char PROGMEM test01_bitmap[] = 
  0x07, 0xBF, 0xDE, 0xAE, 0x6C, 0x68, 0xC0, 0x9C, 0xA8, 0x9C, 0x40, 0x6C, 0x2E, 0xDE, 0x3F, 0x07, 
  0x00, 0x00, 0x0F, 0x00, 0x00, 0x03, 0x06, 0x01, 0x01, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 

//this it the second little sprite
const unsigned char PROGMEM test02_bitmap[] = 
    0x78, 0x5C, 0xEC, 0x2C, 0x6C, 0x68, 0xC0, 0x9C, 0xA8, 0x9C, 0x40, 0x6C, 0x2C, 0xCC, 0x1C, 0x38, 
    0x00, 0x01, 0x1F, 0x01, 0x00, 0x03, 0x06, 0x01, 0x01, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 

// this groups all sprites into 1 sheet, place zero is empty
const unsigned char *spriteSheet[] = 

now you need a byte for cycling frames:

byte frameCount;

and all you have to do is:

if (frameCount > 1) frameCount = 0;
arduboy.drawBitmap(8,16, spriteSheet[frameCount], 16,16, WHITE)

if (frameCount > 1) frameCount = 0;

A slightly more efficient way to write this is:

frameCount = (++frameCount) % 2;

Removes the conditional and saves a few bytes.