diff options
-rw-r--r-- | src/ball.c | 6 | ||||
-rw-r--r-- | src/ball.h | 1 | ||||
-rw-r--r-- | src/game.c | 4 |
3 files changed, 11 insertions, 0 deletions
@@ -26,6 +26,12 @@ free_ball(struct ball *b) } void +update_ball(struct ball *b) +{ + ++b; +} + +void draw_ball(struct ball *b) { mvprintw(b->y, b->x, "o"); @@ -14,6 +14,7 @@ struct ball { struct ball *new_ball(int x, int y); void free_ball(struct ball *b); +void update_ball(struct ball *b); void draw_ball(struct ball *b); #endif @@ -100,6 +100,10 @@ update(struct game *g) update_paddle(&g->players[1]->paddle_h); update_paddle(&g->players[1]->paddle_v); + for (b = g->balls_head; b != NULL; b = b->next) { + update_ball(b); + } + while (g->cur_balls < g->min_balls) { b = new_ball(BALL_START_X_NORMAL, BALL_START_Y_NORMAL); b->next = g->balls_head; |