From 3fbd9f23cb621289ff39499c3d76832e1fd53bef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Fri, 31 Aug 2018 19:01:14 +0200 Subject: [PATCH] Add camera height --- game.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/game.cpp b/game.cpp index a882c0a..0991e82 100644 --- a/game.cpp +++ b/game.cpp @@ -33,7 +33,7 @@ public: mCamera.position.y = 6811; mCamera.direction = 660; mCamera.fovAngle = UNITS_PER_SQUARE / 4; - mCamera.height = UNITS_PER_SQUARE / 2; + mCamera.height = 0; mCamera.resolution.x = 55; mCamera.resolution.y = 88; } @@ -80,6 +80,7 @@ int main() const int16_t step = 50; const int16_t step2 = 10; + const int16_t step3 = 10; Vector2D d = angleToDirection(player.mCamera.direction); @@ -102,6 +103,11 @@ int main() else if (p.leftBtn()) 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.y = clamp(player.mCamera.position.y,UNITS_PER_SQUARE / 2,10 * UNITS_PER_SQUARE - UNITS_PER_SQUARE / 2); }