fix calls to GetRandomValue
This commit is contained in:
parent
9057c47904
commit
0bfc37450c
6 changed files with 58 additions and 58 deletions
|
|
@ -38,17 +38,17 @@ int main(void)
|
|||
|
||||
for (int i = 0; i < MAX_BUILDINGS; i++)
|
||||
{
|
||||
buildings[i].width = (float)GetRandomValue(50, 200);
|
||||
buildings[i].height = (float)GetRandomValue(100, 800);
|
||||
buildings[i].width = (float)GetRandomRangeInt(50, 200);
|
||||
buildings[i].height = (float)GetRandomRangeInt(100, 800);
|
||||
buildings[i].y = screenHeight - 130.0f - buildings[i].height;
|
||||
buildings[i].x = -6000.0f + spacing;
|
||||
|
||||
spacing += (int)buildings[i].width;
|
||||
|
||||
buildColors[i] = (Color){
|
||||
(unsigned char)GetRandomValue(200, 240),
|
||||
(unsigned char)GetRandomValue(200, 240),
|
||||
(unsigned char)GetRandomValue(200, 250),
|
||||
(unsigned char)GetRandomRangeInt(200, 240),
|
||||
(unsigned char)GetRandomRangeInt(200, 240),
|
||||
(unsigned char)GetRandomRangeInt(200, 250),
|
||||
255};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,9 +47,9 @@ int main(void)
|
|||
|
||||
for (int i = 0; i < MAX_COLUMNS; i++)
|
||||
{
|
||||
heights[i] = (float)GetRandomValue(1, 12);
|
||||
positions[i] = (Vector3){ (float)GetRandomValue(-15, 15), heights[i]/2.0f, (float)GetRandomValue(-15, 15) };
|
||||
colors[i] = (Color){ GetRandomValue(20, 255), GetRandomValue(10, 55), 30, 255 };
|
||||
heights[i] = (float)GetRandomRangeInt(1, 12);
|
||||
positions[i] = (Vector3){ (float)GetRandomRangeInt(-15, 15), heights[i]/2.0f, (float)GetRandomRangeInt(-15, 15) };
|
||||
colors[i] = (Color){ GetRandomRangeInt(20, 255), GetRandomRangeInt(10, 55), 30, 255 };
|
||||
}
|
||||
|
||||
DisableCursor(); // Limit cursor to relative movement inside the window
|
||||
|
|
|
|||
|
|
@ -119,9 +119,9 @@ int main(void)
|
|||
static Color GenerateRandomColor()
|
||||
{
|
||||
Color color = {
|
||||
GetRandomValue(0, 255),
|
||||
GetRandomValue(0, 255),
|
||||
GetRandomValue(0, 255),
|
||||
GetRandomRangeInt(0, 255),
|
||||
GetRandomRangeInt(0, 255),
|
||||
GetRandomRangeInt(0, 255),
|
||||
255
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ int main(void)
|
|||
|
||||
// SetRandomSeed(0xaabbccff); // Set a custom random seed if desired, by default: "time(NULL)"
|
||||
|
||||
int randValue = GetRandomValue(-8, 5); // Get a random integer number between -8 and 5 (both included)
|
||||
int randValue = GetRandomRangeInt(-8, 5); // Get a random integer number between -8 and 5 (both included)
|
||||
|
||||
unsigned int framesCounter = 0; // Variable used to count frames
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ int main(void)
|
|||
// Every two seconds (120 frames) a new random value is generated
|
||||
if (((framesCounter/120)%2) == 1)
|
||||
{
|
||||
randValue = GetRandomValue(-8, 5);
|
||||
randValue = GetRandomRangeInt(-8, 5);
|
||||
framesCounter = 0;
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ int main(void)
|
|||
//----------------------------------------------------------------------------------
|
||||
if (IsKeyPressed(KEY_R))
|
||||
{
|
||||
score = GetRandomValue(1000, 2000);
|
||||
hiscore = GetRandomValue(2000, 4000);
|
||||
score = GetRandomRangeInt(1000, 2000);
|
||||
hiscore = GetRandomRangeInt(2000, 4000);
|
||||
}
|
||||
|
||||
if (IsKeyPressed(KEY_ENTER))
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ int main(void)
|
|||
SetTextureFilter(target.texture, TEXTURE_FILTER_BILINEAR); // Texture scale filter to use
|
||||
|
||||
Color colors[10] = { 0 };
|
||||
for (int i = 0; i < 10; i++) colors[i] = (Color){ GetRandomValue(100, 250), GetRandomValue(50, 150), GetRandomValue(10, 100), 255 };
|
||||
for (int i = 0; i < 10; i++) colors[i] = (Color){ GetRandomRangeInt(100, 250), GetRandomRangeInt(50, 150), GetRandomRangeInt(10, 100), 255 };
|
||||
|
||||
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
|
@ -59,7 +59,7 @@ int main(void)
|
|||
if (IsKeyPressed(KEY_SPACE))
|
||||
{
|
||||
// Recalculate random colors for the bars
|
||||
for (int i = 0; i < 10; i++) colors[i] = (Color){ GetRandomValue(100, 250), GetRandomValue(50, 150), GetRandomValue(10, 100), 255 };
|
||||
for (int i = 0; i < 10; i++) colors[i] = (Color){ GetRandomRangeInt(100, 250), GetRandomRangeInt(50, 150), GetRandomRangeInt(10, 100), 255 };
|
||||
}
|
||||
|
||||
// Update virtual mouse (clamped mouse value behind game screen)
|
||||
|
|
|
|||
Loading…
Reference in a new issue