From a7d86efdb931a9587f0dffa1542569a562ce9a1b Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Tue, 10 Dec 2024 21:49:41 +0500 Subject: fix: stars were positioned in spiral --- src/star.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/star.c b/src/star.c index e8d2dfd..a0de9cc 100644 --- a/src/star.c +++ b/src/star.c @@ -7,11 +7,13 @@ #include "raylib.h" Vector3 Generate3DPosition() { - double random = (double)rand() / RAND_MAX; + double angle_random = (double)rand() / (double)RAND_MAX; + double radius_random = (double)rand() / (double)RAND_MAX; - double angle = random * 2.0 * M_PI; - double radius = - (GetScreenHeight() / SPACE_SIZE) + (random * GetScreenHeight()); + double angle = angle_random * 2.0 * M_PI; + + double radius = (GetScreenHeight() / SPACE_SIZE) + + (radius_random * GetScreenHeight()) * SPACE_SIZE; float x = radius * sin(angle); float y = radius * cos(angle); -- cgit v1.2.3