summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2024-12-11 17:00:10 +0500
committerilotterytea <iltsu@alright.party>2024-12-11 17:00:10 +0500
commit12afbb3293e7f2084b169359a7537490343e3cee (patch)
tree300a6e9de697a25721f3b98f42303efa905dce1a
parent5231f1e361fa7be8980a6463877b942f167f27e7 (diff)
feat: move the star if it is closer to the camera
-rw-r--r--src/main.c8
1 files changed, 8 insertions, 0 deletions
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 <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 =