diff options
author | P. J. McDermott <pj@pehjota.net> | 2021-03-27 16:41:27 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2021-03-27 16:41:27 (EDT) |
commit | 73d8c3a9db365cd19aa23afb2bc37879826780dd (patch) | |
tree | 4d2d2afaf7a9ca0ad79cd8936c1ab09bb950a1a0 /src | |
parent | 30bb703ff3185f9c9c05cfbd67f0d008ea4c29bb (diff) | |
download | dodge-balls-73d8c3a9db365cd19aa23afb2bc37879826780dd.zip dodge-balls-73d8c3a9db365cd19aa23afb2bc37879826780dd.tar.gz dodge-balls-73d8c3a9db365cd19aa23afb2bc37879826780dd.tar.bz2 |
ball: Don't collide spinning balls with others
Diffstat (limited to 'src')
-rw-r--r-- | src/ball.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -102,11 +102,15 @@ db_balls_collisions(struct db_ball *ball) int col_x; int col_y; - for (other = ball->next; other != NULL; other = other->next) { - if (db_col_pt_cir_cir(ball->x, ball->y, ball->r, - other->x, other->y, other->r, - &col_x, &col_y)) { - /* TODO: Reverse direction */ + /* Spinning balls shouldn't collide with any other balls */ + if (ball->sr == 0) { + for (other = ball->next; other != NULL; other = other->next) { + if (other->sr == 0 && db_col_pt_cir_cir( + ball->x, ball->y, ball->r, + other->x, other->y, other->r, + &col_x, &col_y)) { + /* TODO: Reverse direction */ + } } } |