summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ball.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/ball.c b/src/ball.c
index 552aadd..5c0497d 100644
--- a/src/ball.c
+++ b/src/ball.c
@@ -118,7 +118,6 @@ db_balls_collisions(struct db_ball *ball)
int x_max;
int y_min;
int y_max;
- SDL_bool bounce;
int x;
int y;
double col_x;
@@ -131,7 +130,6 @@ db_balls_collisions(struct db_ball *ball)
x_max = ceil ((ball->x + ball->r) / map_tw);
y_min = floor((ball->y - ball->r) / map_th);
y_max = ceil ((ball->y + ball->r) / map_th);
- bounce = SDL_FALSE;
for (y = y_min; y < y_max; ++y) {
for (x = x_min; x < x_max; ++x) {
if (db_map_tile_ball_collides(ball->map, x, y)) {
@@ -139,14 +137,11 @@ db_balls_collisions(struct db_ball *ball)
wall.y = y * map_th;
if (db_col_cir_rect(ball->x, ball->y, ball->r,
&wall, &col_x, &col_y)){
- bounce = SDL_TRUE;
+ _db_ball_bounce(ball, col_x, col_y);
}
}
}
}
- if (bounce) {
- _db_ball_bounce(ball, col_x, col_y);
- }
/* Spinning balls shouldn't collide with any other balls */
if (ball->sr == 0) {