Add camera height

This commit is contained in:
Miloslav Číž 2018-08-31 19:01:14 +02:00
parent 7a2a38df3c
commit 3fbd9f23cb

View file

@ -33,7 +33,7 @@ public:
mCamera.position.y = 6811; mCamera.position.y = 6811;
mCamera.direction = 660; mCamera.direction = 660;
mCamera.fovAngle = UNITS_PER_SQUARE / 4; mCamera.fovAngle = UNITS_PER_SQUARE / 4;
mCamera.height = UNITS_PER_SQUARE / 2; mCamera.height = 0;
mCamera.resolution.x = 55; mCamera.resolution.x = 55;
mCamera.resolution.y = 88; mCamera.resolution.y = 88;
} }
@ -80,6 +80,7 @@ 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);
@ -102,6 +103,11 @@ int main()
else if (p.leftBtn()) else if (p.leftBtn())
player.mCamera.direction -= step2; player.mCamera.direction -= step2;
if (p.bBtn())
player.mCamera.height += step3;
else if (p.cBtn())
player.mCamera.height -= step3;
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);
} }