From 12afbb3293e7f2084b169359a7537490343e3cee Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Wed, 11 Dec 2024 17:00:10 +0500 Subject: feat: move the star if it is closer to the camera --- src/main.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index c3e69ff..135c7ad 100644 --- a/src/main.c +++ b/src/main.c @@ -2,6 +2,7 @@ #include #include "constants.h" +#include "math.h" #include "raylib.h" #include "star.h" #include "stdlib.h" @@ -57,6 +58,13 @@ int main(int argc, char* argv[]) { float screen_center_y = mouse_control ? GetMouseY() : GetScreenHeight() / 2.0; + if (star->position.z <= 5.0) { + int x = abs((int)pow(star->renderPosition.x, star->position.z / 10.0)); + + if (star->renderPosition.x < screen_center_x) star->position.x -= x; + if (star->renderPosition.x > screen_center_x) star->position.x += x; + } + StarUpdate(star, screen_center_x, screen_center_y); star->color.a = -- cgit v1.2.3