diff options
author | P. J. McDermott <pjm@nac.net> | 2013-05-21 18:22:53 (EDT) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2013-05-21 18:23:27 (EDT) |
commit | 4e6e4ab53d3d43725f117c0dbf613b2bd9c7794c (patch) | |
tree | ea6cbf42c49cddfae32841d0108c1fc357aace47 | |
parent | 456372dc946a7562126047b5e179da32a6cee4be (diff) | |
download | cursespong-4e6e4ab53d3d43725f117c0dbf613b2bd9c7794c.zip cursespong-4e6e4ab53d3d43725f117c0dbf613b2bd9c7794c.tar.gz cursespong-4e6e4ab53d3d43725f117c0dbf613b2bd9c7794c.tar.bz2 |
Write a stub update_ball().
-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; |