diff options
author | P. J. McDermott <pj@pehjota.net> | 2021-03-30 01:02:57 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2021-03-30 01:02:57 (EDT) |
commit | 1c5f2fa86286137a86da01cbc3f67e204442b558 (patch) | |
tree | 3fbaa866b0487cc900c2bae6b32f7b4f41fc41d5 | |
parent | f691e5f266a42aac8a14eb6c71e59111cc9fa16f (diff) | |
download | dodge-balls-1c5f2fa86286137a86da01cbc3f67e204442b558.zip dodge-balls-1c5f2fa86286137a86da01cbc3f67e204442b558.tar.gz dodge-balls-1c5f2fa86286137a86da01cbc3f67e204442b558.tar.bz2 |
ball: Undo bounce reduction
-rw-r--r-- | src/ball.c | 7 |
1 files changed, 1 insertions, 6 deletions
@@ -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) { |