summaryrefslogtreecommitdiffstats
path: root/src/ball.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ball.c')
-rw-r--r--src/ball.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/ball.c b/src/ball.c
index 862efc4..1386cfd 100644
--- a/src/ball.c
+++ b/src/ball.c
@@ -77,6 +77,23 @@ db_ball_new(int x, int y, int r, int a, int d, int sr, double s,
}
void
+db_balls_move(struct db_ball *ball)
+{
+ if (ball->sr == 0) {
+ } else {
+ ball->a += ball->d * ball->s;
+ 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)",
+ ball->a, ball->s, ball->d);
+ }
+
+ if (ball->next != NULL) {
+ db_balls_move(ball->next);
+ }
+}
+
+void
db_balls_collisions(struct db_ball *ball)
{
struct db_ball *other;