This commit is contained in:
Miloslav Číž 2018-09-01 09:07:27 +02:00
parent 0ed24fdcd2
commit b3176f613d

View file

@ -43,14 +43,14 @@ Pokitto::Core p;
Character player; Character player;
Level level; Level level;
int16_t heightFunc(int16_t x, int16_t y) Unit heightFunc(int16_t x, int16_t y)
{ {
return level.getHeight(x,y); return level.getHeight(x,y) * UNITS_PER_SQUARE;
} }
void pixelFunc(PixelInfo pixel) void pixelFunc(PixelInfo pixel)
{ {
p.display.color = pixel.hit.direction + 4; p.display.color = pixel.isWall ? pixel.hit.direction + 4 : 3;
p.display.drawPixel(pixel.position.x * 2,pixel.position.y); p.display.drawPixel(pixel.position.x * 2,pixel.position.y);
p.display.drawPixel(pixel.position.x * 2 + 1,pixel.position.y); p.display.drawPixel(pixel.position.x * 2 + 1,pixel.position.y);
} }
@ -80,7 +80,6 @@ int main()
const int16_t step = 50; const int16_t step = 50;
const int16_t step2 = 10; const int16_t step2 = 10;
const int16_t step3 = 10;
Vector2D d = angleToDirection(player.mCamera.direction); Vector2D d = angleToDirection(player.mCamera.direction);
@ -104,9 +103,9 @@ int main()
player.mCamera.direction -= step2; player.mCamera.direction -= step2;
if (p.bBtn()) if (p.bBtn())
player.mCamera.height += step3; player.mCamera.height += step;
else if (p.cBtn()) else if (p.cBtn())
player.mCamera.height -= step3; player.mCamera.height -= step;
player.mCamera.position.x = clamp(player.mCamera.position.x,UNITS_PER_SQUARE / 2,10 * UNITS_PER_SQUARE - UNITS_PER_SQUARE / 2); player.mCamera.position.x = clamp(player.mCamera.position.x,UNITS_PER_SQUARE / 2,10 * UNITS_PER_SQUARE - UNITS_PER_SQUARE / 2);
player.mCamera.position.y = clamp(player.mCamera.position.y,UNITS_PER_SQUARE / 2,10 * UNITS_PER_SQUARE - UNITS_PER_SQUARE / 2); player.mCamera.position.y = clamp(player.mCamera.position.y,UNITS_PER_SQUARE / 2,10 * UNITS_PER_SQUARE - UNITS_PER_SQUARE / 2);