diff --git a/src/ball.c b/src/ball.c index fecfbb6..cf2af41 100644 --- a/src/ball.c +++ b/src/ball.c @@ -21,7 +21,10 @@ Ball_init(int screen_width, int screen_height) void Ball_reset(Ball *b, int direction) { // 120 deg angle with norm horizontal vector - const int angle = rand() % 60 + 60; + int angle; + do { + angle = rand() % 60 + 60; + } while (angle == 90); b->posX = b->SCREEN_WIDTH/2; b->posY = b->SCREEN_HEIGHT/2; b->velX = direction * b->BALL_VELOCITY * cos(angle * 2 * M_PI / 180);