fix calls to GetRandomValue

This commit is contained in:
Bigfoot71 2025-05-10 21:45:42 +02:00
commit 0bfc37450c
3 changed files with 58 additions and 58 deletions

View file

@ -64,11 +64,11 @@ int main(void)
if (bunniesCount < MAX_BUNNIES)
{
bunnies[bunniesCount].position = GetMousePosition();
bunnies[bunniesCount].speed.x = (float)GetRandomValue(-250, 250)/60.0f;
bunnies[bunniesCount].speed.y = (float)GetRandomValue(-250, 250)/60.0f;
bunnies[bunniesCount].color = (Color){ GetRandomValue(50, 240),
GetRandomValue(80, 240),
GetRandomValue(100, 240), 255 };
bunnies[bunniesCount].speed.x = (float)GetRandomRangeInt(-250, 250)/60.0f;
bunnies[bunniesCount].speed.y = (float)GetRandomRangeInt(-250, 250)/60.0f;
bunnies[bunniesCount].color = (Color){ GetRandomRangeInt(50, 240),
GetRandomRangeInt(80, 240),
GetRandomRangeInt(100, 240), 255 };
bunniesCount++;
}
}

View file

@ -53,7 +53,7 @@ int main(void)
// Load map tiles (generating 2 random tile ids for testing)
// NOTE: Map tile ids should be probably loaded from an external map file
for (unsigned int i = 0; i < map.tilesY*map.tilesX; i++) map.tileIds[i] = GetRandomValue(0, 1);
for (unsigned int i = 0; i < map.tilesY*map.tilesX; i++) map.tileIds[i] = GetRandomRangeInt(0, 1);
// Player position on the screen (pixel coordinates, not tile coordinates)
Vector2 playerPosition = { 180, 130 };

View file

@ -46,10 +46,10 @@ int main(void)
for (int i = 0; i < MAX_PARTICLES; i++)
{
mouseTail[i].position = (Vector2){ 0, 0 };
mouseTail[i].color = (Color){ GetRandomValue(0, 255), GetRandomValue(0, 255), GetRandomValue(0, 255), 255 };
mouseTail[i].color = (Color){ GetRandomRangeInt(0, 255), GetRandomRangeInt(0, 255), GetRandomRangeInt(0, 255), 255 };
mouseTail[i].alpha = 1.0f;
mouseTail[i].size = (float)GetRandomValue(1, 30)/20.0f;
mouseTail[i].rotation = (float)GetRandomValue(0, 360);
mouseTail[i].size = (float)GetRandomRangeInt(1, 30)/20.0f;
mouseTail[i].rotation = (float)GetRandomRangeInt(0, 360);
mouseTail[i].active = false;
}