Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Camera
- {
- float x;
- float y;
- float zoom = 1;
- };
- Camera camera = {};
- void update()
- {
- float player_x = 0;
- float player_y = 0;
- float player_width = 32;
- float player_height = 32;
- float new_x = player_x - camera.x;
- float new_y = player_y - camera.y;
- new_x *= camera.zoom;
- new_y *= camera.zoom;
- draw_player(new_x, new_y, player_width * camera.zoom, player_height * camera.zoom);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement