diff options
| -rw-r--r-- | src/constants.h | 5 | ||||
| -rw-r--r-- | src/star.c | 7 |
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 @@ -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; |
