diff --git a/src/structs.h b/src/structs.h index 78f168d..a48e6ee 100644 --- a/src/structs.h +++ b/src/structs.h @@ -287,7 +287,6 @@ struct Tuple { }; typedef struct { - SDL_Rect bounds; float shakeAmount; int x; int y; diff --git a/src/util/maths.c b/src/util/maths.c index d77dd2b..b7ea34b 100644 --- a/src/util/maths.c +++ b/src/util/maths.c @@ -42,12 +42,12 @@ int getPercent(float current, float total) float limit(float i, float a, float b) { - if (i > a) + if (i < a) { return a; } - if (i < b) + if (i > b) { return b; } diff --git a/src/world/camera.c b/src/world/camera.c index 21b528b..f294a1d 100644 --- a/src/world/camera.c +++ b/src/world/camera.c @@ -84,10 +84,8 @@ float cameraChase(Entity *e, int maxSpeed) void clip(void) { - camera.bounds.x = (int) limit(camera.x, world.map.bounds.x, world.map.bounds.w); - camera.bounds.y = (int) limit(camera.y, world.map.bounds.y, world.map.bounds.h + (MAP_TILE_SIZE * 3)); - camera.bounds.w = SCREEN_WIDTH; - camera.bounds.h = SCREEN_HEIGHT; + camera.x = (int) limit(camera.x, world.map.bounds.x, world.map.bounds.w); + camera.y = (int) limit(camera.y, world.map.bounds.y, world.map.bounds.h); } int isOnScreen(Entity *e)