diff options
| author | ilotterytea <iltsu@alright.party> | 2024-12-11 17:00:10 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2024-12-11 17:00:10 +0500 |
| commit | 12afbb3293e7f2084b169359a7537490343e3cee (patch) | |
| tree | 300a6e9de697a25721f3b98f42303efa905dce1a | |
| parent | 5231f1e361fa7be8980a6463877b942f167f27e7 (diff) | |
feat: move the star if it is closer to the camera
| -rw-r--r-- | src/main.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -2,6 +2,7 @@ #include <stdlib.h> #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 = |
