Add sprite distance

This commit is contained in:
Miloslav Číž 2018-09-06 09:40:40 +02:00
parent 4f1cb9aaaa
commit 0b0ade51b8

View file

@ -26,6 +26,7 @@
#define MIDDLE_COLUMN (SCREEN_WIDTH / 2)
#define SPRITES 3
#define SPRITE_MAX_DISTANCE 5 * UNITS_PER_SQUARE
Pokitto::Core p;
@ -699,6 +700,9 @@ void draw()
for (uint8_t i = 0; i < SPRITES; ++i)
{
if (dist(sprites[i].mPosition,player.mCamera.position) > SPRITE_MAX_DISTANCE)
continue;
PixelInfo pos = mapToScreen(sprites[i].mPosition,sprites[i].mHeight,player.mCamera);
if (pos.depth > 0)