@NoobGeek,
Welcome to the Arduboy Forum!
First:
When you post code in this forum, please enclose it in markdown code tags:
Start with a line containing three backticks followed by cpp
.
Insert your code starting on the following line.
On the line following you code, put another three backticks.
The backtick character is commonly on the key below the Esc
key at the top left of a U.S. keyboard. If you can’t find it on your keyboard, you can copy and paste from the tags here:
```cpp
The first line of your code
More code
The last line of your code
```
I’ve added the tags to your post above but please do it yourself in the future.
You’ll have to be more specific and/or provide more code showing how you’re trying to display and move your sprite. I wrote a simple sketch that draws and allows you to move your sprite using the D-pad. It may provide information that helps you.
#include <Arduboy2.h>
Arduboy2 arduboy;
const unsigned char PROGMEM noname[] =
{
// width, height,
16, 16,
// TILE 00
0xff, 0xff, 0xff, 0xff, 0xff, 0x03, 0xb9, 0xb1, 0xb1, 0xb9, 0x83, 0x1f, 0xff, 0xff, 0xff, 0xff,
0xff, 0x07, 0x73, 0x7b, 0x7b, 0x78, 0x3f, 0x9f, 0xdf, 0x9f, 0xbf, 0x38, 0x79, 0x39, 0xb3, 0x87,
};
int16_t xPos = 0;
int16_t yPos = 0;
void setup() {
arduboy.begin();
arduboy.setFrameRate(45);
}
void loop() {
if(!arduboy.nextFrame()) {
return;
}
arduboy.pollButtons();
arduboy.clear();
if (arduboy.justPressed(UP_BUTTON)) {
--yPos;
}
if (arduboy.justPressed(DOWN_BUTTON)) {
++yPos;
}
if (arduboy.justPressed(LEFT_BUTTON)) {
--xPos;
}
if (arduboy.justPressed(RIGHT_BUTTON)) {
++xPos;
}
Sprites::drawOverwrite(xPos, yPos, noname, 0);
arduboy.display();
}
NoobGeek1.hex (19.5 KB)