]> git.armaanb.net Git - pong.git/commitdiff
Reset y value of ball after point
authorArmaan Bhojwani <me@armaanb.net>
Sun, 16 May 2021 01:41:44 +0000 (21:41 -0400)
committerArmaan Bhojwani <me@armaanb.net>
Sun, 16 May 2021 01:41:44 +0000 (21:41 -0400)
pong.c

diff --git a/pong.c b/pong.c
index 72b5602763c04924b9eac37652a7f24edf4ab7db..a61bc0d68bc5986ced25f223cf274c9e275d97e4 100644 (file)
--- a/pong.c
+++ b/pong.c
@@ -159,12 +159,16 @@ main(void) {
                                mvprintw(0, 0, "PLAYER A SCORES");
                        }
                        refresh();
+
+                       // Reset to default values
                        x = max_x/2;
+                       y = max_y / 2;
                        slope_x = randslope();
                        index_dir = randsign();
                        speed = randspeed();
                        aoff = max_y / 2 - pad_h;
                        boff = max_y / 2 - pad_h;
+
                        sleep(1);
                        clear();
                } else if (y == 0 || y == max_y) {