For some reason, on my build it causes the player character’s body to glitch out.
But that’s not the case in your build. Are we using different emulators or did you do something to the code?
Did a bit of clean up:
#ifndef PLAYER_H
#define PLAYER_H
#include "box.h"
#include "scroll.h"
int direction = 0;
int walkframe = -1;
int idleframe = 0;
int ground = 0;
int pole = 0;
void player()
{
//arduboy.fillCircle(playerx, playery, 32, WHITE);
if(arduboy.pressed(LEFT_BUTTON))
{
playerx = playerx - 1;
direction = 1;
walkframe = walkframe+1;
idleframe = 0;
}
if(arduboy.pressed(RIGHT_BUTTON))
{
playerx = playerx + 1;
direction = 0;
walkframe = walkframe+1;
idleframe = 0;
}
if(!arduboy.pressed(LEFT_BUTTON) && !arduboy.pressed(RIGHT_BUTTON))
{
walkframe = -1;
}
if((arduboy.pressed(UP_BUTTON)) && pole>0)
{
playery = playery - 1;
}
if (pole <= 0)
{
playery = playery + 1;
}
if (playerx<8)
{
playerx = 8;
}
if (playerx>208)
{
playerx = 208;
}
if (walkframe>15)
{
walkframe = 0;
}
if (walkframe<0)
{
idleframe = idleframe + 1;
}
arduboy.print(direction);
}
void playergfx()
{
if(direction == 0)
{
if(ground >= 1)
{
Sprites::drawPlusMask((playerx - 8) - (camerax - 64), (playery - 8) - cameray, maxrunright_plus_mask, (walkframe / 4));
}
if(ground <= 0)
{
Sprites::drawPlusMask((playerx - 8) - (camerax - 64), (playery - 8) - cameray, maxrunright_plus_mask, 0);
}
if ((walkframe < 0) && (idleframe < 40) && (ground >= 1))
{
Sprites::drawPlusMask((playerx - 8) - (camerax - 64), (playery - 8) - cameray, maxstandright_plus_mask, (walkframe / 4));
}
if ((idleframe >= 40) && (ground >= 1))
{
Sprites::drawPlusMask((playerx - 8) - (camerax - 64), (playery - 8) - cameray, maxidle_plus_mask, 0);
}
}
if(direction == 1)
{
if(ground >= 1)
{
Sprites::drawPlusMask((playerx - 8) - (camerax - 64), (playery - 8) - cameray, maxrunleft_plus_mask, (walkframe / 4));
}
if(ground <= 0)
{
Sprites::drawPlusMask((playerx - 8) - (camerax - 64), (playery - 8) - cameray, maxrunleft_plus_mask, 0);
}
if ((walkframe < 0) && (idleframe < 40) && (ground >= 1))
{
Sprites::drawPlusMask((playerx - 8) - (camerax - 64), (playery - 8) - cameray, maxstandleft_plus_mask, (walkframe / 4));
}
if ((idleframe >= 40) && (ground >= 1))
{
Sprites::drawPlusMask((playerx - 8) - (camerax - 64), (playery - 8) - cameray, maxidle_plus_mask, 0);
}
}
if(arduboy.pressed(LEFT_BUTTON) && (ground >= 1))
{
Sprites::drawPlusMask((playerx - 8) - (camerax - 64), (playery - 8) - cameray, maxrunleft_plus_mask, (walkframe / 4));
}
if(arduboy.pressed(RIGHT_BUTTON) && (ground >= 1))
{
Sprites::drawPlusMask((playerx - 8) - (camerax - 64), (playery - 8) - cameray, maxrunright_plus_mask, (walkframe / 4));
}
if (direction == 0)
{
if ((walkframe >= 0) && (idleframe < 40) && (ground >= 1))
{
Sprites::drawPlusMask((playerx - 8) - (camerax - 64), (playery - 8) - cameray, maxrunright_plus_mask, (walkframe / 4));
}
if ((walkframe < 0) && (idleframe < 40) && (ground >= 1))
{
Sprites::drawPlusMask((playerx - 8) - (camerax - 64), (playery - 8) - cameray, maxstandright_plus_mask, 0);
}
else if ((idleframe >= 40) && (ground >= 1))
{
Sprites::drawPlusMask((playerx - 8) - (camerax - 64), (playery - 8) - cameray, maxidle_plus_mask, 0);
}
else if (ground <= 0)
{
Sprites::drawPlusMask((playerx - 8) - (camerax - 64), (playery - 8) - cameray, maxrunright_plus_mask, 0);
}
}
if (direction == 1)
{
if ((walkframe >= 0) && (idleframe < 40) && (ground >= 1))
{
Sprites::drawPlusMask((playerx - 8) - (camerax - 64), (playery - 8) - cameray, maxrunleft_plus_mask, (walkframe / 4));
}
if ((walkframe < 0) && (idleframe < 40) && (ground >= 1))
{
Sprites::drawPlusMask((playerx - 8) - (camerax - 64), (playery - 8) - cameray, maxstandleft_plus_mask, 0);
}
else if ((idleframe >= 40) && (ground >= 1))
{
Sprites::drawPlusMask((playerx - 8) - (camerax - 64), (playery - 8) - cameray, maxidle_plus_mask, 0);
}
else if (ground <= 0)
{
Sprites::drawPlusMask((playerx - 8) - (camerax - 64), (playery - 8) - cameray, maxrunleft_plus_mask, 0);
}
}
}
#endif
Now it runs mostly as intended.
scarlettower.ino.hex (35.4 KB)
I expect there’s a lot of redundancy going on though given how many Sprites::drawPlusMask
s there are.
@Mypka_MaxCat, are your libraries up to date?
And are you building your .hex
with the Arduino IDE or Project ABE?
I’ve posted some instructions on how to use the Team A.R.G. tools from downloaded copies.
I built it on Project ABE’s integrated development environment. (ProjectABE should be updated more often…)
Also, how does this work on your build, but not on mine? That doesn’t make any sense.
Did you change other code too to get it? We used the same emulator to show the HEX file.
Presumably because I’m using the Arduino IDE* to compile my .hex
, the same as @filmote.
(* Well, technically VSCode/VSCodium, but they’re using the same Arduino IDE backend, so close enough.)
In which case it seems that the problem is either to do with the version of the compiler or the version of Arduboy2 used by ProjectABE.
Given the similarity to a bug that has since been eliminated from the Arduboy2 library,
I suspect it’s more likely to be an out-of-date Arduboy2 version rather than a compiler bug.
(I don’t actually know how to compile with ProjectABE so I have no clue how to test that theory.)
In the first comment where I reported that the sprite rendering was working:
Adding #include "box.h"
was literally the only change I made at that point.
I’ve made other changes since, but even before those the rendering was working fine.
The only way I’ve been able to experience the bug is by loading the .hex
you posted earlier onto my Arduboy.
All the .hex
files I’ve generated from the code on your GitHub using the Arduino IDE(/VSCodium) have not had the rendering bug.
You can go to ProjectABE website, create a project, and press the “Build” button when done. This builds the HEX file on it.
Your build works great on the emulator. I can’t get the code cleanup to work when I paste it though…
Merry christmas! I just started working on the HTML5 version of Milona Scarlet, so it can be released along with the Arduboy version.
Here is an artwork on DeviantArt:
Hello, folks! I’m coming back to the community to let you know how I’ve been doing with the HTML5 version. It’s going well so far. Also, how’s this title: Scarlet Arcade?
(Bubble Demo)
ArduboyProject (5).hex (21.9 KB)
The bubble is drawn with only the built-in circles (a sprite will be added to that in the final Arduboy game, along with Anna trapped in it).
GIF version: