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?