draw shot
parent
37956daf7f
commit
b279c190cb
65
src/main.cpp
65
src/main.cpp
|
@ -219,6 +219,71 @@ void HeldObject()
|
|||
dma_display->printf("Score: %d", score);
|
||||
}
|
||||
}
|
||||
|
||||
// Stickman
|
||||
|
||||
int X_shot = 0;
|
||||
int Y_shot = 32;
|
||||
bool created_shot = false;
|
||||
bool direction = false;
|
||||
void Drawshot(bool deleted = false)
|
||||
{
|
||||
// measure x dimension
|
||||
|
||||
if (!created_shot)
|
||||
{
|
||||
int ran = random(1, 3);
|
||||
if (ran == 1)
|
||||
{
|
||||
X_shot = 1;
|
||||
direction = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
X_shot = 126;
|
||||
direction = true;
|
||||
}
|
||||
created_shot = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (direction == false)
|
||||
{
|
||||
X_shot += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
X_shot -= 1;
|
||||
}
|
||||
}
|
||||
int min_x = X_shot - 1;
|
||||
int max_x = X_shot;
|
||||
int min_y = Y_shot - 1;
|
||||
int max_y = Y_shot;
|
||||
if (deleted)
|
||||
{
|
||||
for (int i = min_x; i <= max_x; i++)
|
||||
{
|
||||
for (int j = min_y; j <= max_y; j++)
|
||||
{
|
||||
if (j <= 32)
|
||||
dma_display->drawPixelRGB888(i, j, 0, 0, 255);
|
||||
else
|
||||
dma_display->drawPixelRGB888(i, j, 0, 255, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = min_x; i <= max_x; i++)
|
||||
{
|
||||
for (int j = min_y; j <= max_y; j++)
|
||||
{
|
||||
dma_display->drawPixelRGB888(i, j, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
int *drawStickMan(int x, int y)
|
||||
{
|
||||
int range[4];
|
||||
|
|
Loading…
Reference in New Issue