From 73d8c3a9db365cd19aa23afb2bc37879826780dd Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sat, 27 Mar 2021 16:41:27 -0400 Subject: ball: Don't collide spinning balls with others --- diff --git a/src/ball.c b/src/ball.c index ccdccec..d7941b9 100644 --- a/src/ball.c +++ b/src/ball.c @@ -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 */ + } } } -- cgit v0.9.1