diff options
author | P. J. McDermott <pj@pehjota.net> | 2021-03-27 17:50:14 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2021-03-27 17:50:14 (EDT) |
commit | 4a539a2210b90f4580adb46f9f8df7da2a391c29 (patch) | |
tree | baf159359cda9569479b92824d33ab3cc05d09af /src | |
parent | 1af54624335128aa81ced4cd11c064a2188b296f (diff) | |
download | dodge-balls-4a539a2210b90f4580adb46f9f8df7da2a391c29.zip dodge-balls-4a539a2210b90f4580adb46f9f8df7da2a391c29.tar.gz dodge-balls-4a539a2210b90f4580adb46f9f8df7da2a391c29.tar.bz2 |
ball: Keep angle in [0, 360)
Diffstat (limited to 'src')
-rw-r--r-- | src/ball.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -87,7 +87,7 @@ db_balls_move(struct db_ball *ball) ball->x += cos(ball->a * (M_PI / 180)); ball->y += sin(ball->a * (M_PI / 180)); } else { - ball->a += ball->d * ball->s; + ball->a = fmod(ball->a + ball->d * ball->s, 360); ball->x = ball->cx + cos(ball->a * (M_PI / 180)) * ball->sr; ball->y = ball->cy + sin(ball->a * (M_PI / 180)) * ball->sr; db_dbg("Spinning ball angle %f (speed %f, direction %d)", |