summaryrefslogtreecommitdiffhomepage
path: root/examples/core
diff options
context:
space:
mode:
Diffstat (limited to 'examples/core')
-rw-r--r--examples/core/core_2d_camera.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/examples/core/core_2d_camera.c b/examples/core/core_2d_camera.c
index 81f580ad..ba432f46 100644
--- a/examples/core/core_2d_camera.c
+++ b/examples/core/core_2d_camera.c
@@ -42,7 +42,7 @@ int main(void)
Camera2D camera = { 0 };
camera.target = (Vector2){ player.x + 20, player.y + 20 };
- camera.offset = (Vector2){ 0, 0 };
+ camera.offset = (Vector2){ screenWidth / 2, screenHeight / 2 };
camera.rotation = 0.0f;
camera.zoom = 1.0f;
@@ -57,12 +57,10 @@ int main(void)
if (IsKeyDown(KEY_RIGHT))
{
player.x += 2; // Player movement
- camera.offset.x -= 2; // Camera displacement with player movement
}
else if (IsKeyDown(KEY_LEFT))
{
player.x -= 2; // Player movement
- camera.offset.x += 2; // Camera displacement with player movement
}
// Camera target follows player
@@ -135,4 +133,4 @@ int main(void)
//--------------------------------------------------------------------------------------
return 0;
-} \ No newline at end of file
+}