summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2024-12-11 13:12:28 +0500
committerilotterytea <iltsu@alright.party>2024-12-11 13:12:28 +0500
commitcf6f0f7038e7736f200f600c09f82ae350bc05b3 (patch)
tree5f2a62681f4c2e4780cfd0072e18e0a3516e6e2a
parent493b668742ceb28a4e10ca5016e652f9638429aa (diff)
upd: max and min for start pos z
-rw-r--r--src/constants.h5
-rw-r--r--src/star.c7
2 files changed, 8 insertions, 4 deletions
diff --git a/src/constants.h b/src/constants.h
index 1edb712..3b9d446 100644
--- a/src/constants.h
+++ b/src/constants.h
@@ -1,6 +1,7 @@
#define STAR_AMOUNT 1000
-#define STAR_START_POS_Z 20.0
+#define STAR_START_POS_Z_MAX 20
+#define STAR_START_POS_Z_MIN 10
#define STAR_MIN_VELOCITY 1
-#define STAR_MAX_VELOCITY 25
+#define STAR_MAX_VELOCITY 5
#define SPACE_SIZE 35.0
diff --git a/src/star.c b/src/star.c
index 4676a8f..822b9cf 100644
--- a/src/star.c
+++ b/src/star.c
@@ -18,7 +18,9 @@ Vector3 Generate3DPosition() {
float x = radius * sin(angle);
float y = radius * cos(angle);
- Vector3 v = {x, y, STAR_START_POS_Z};
+ Vector3 v = {x, y,
+ rand() % (STAR_START_POS_Z_MAX + 1 - STAR_START_POS_Z_MIN) +
+ STAR_START_POS_Z_MIN};
return v;
}
@@ -38,7 +40,8 @@ void StarUpdate(Star *star, float screen_center_x, float screen_center_y) {
star->renderPosition.x = x;
star->renderPosition.y = y;
- float size = (STAR_START_POS_Z - star->position.z) / (0.2 * star->position.z);
+ float size =
+ (STAR_START_POS_Z_MAX - star->position.z) / (0.2 * star->position.z);
star->size.x = size;
star->size.y = size;