Skip to content

Instantly share code, notes, and snippets.

@Saafan
Created November 7, 2020 21:07
Show Gist options
  • Save Saafan/23a6567ea7f4c739dfdd02bb391a826e to your computer and use it in GitHub Desktop.
Save Saafan/23a6567ea7f4c739dfdd02bb391a826e to your computer and use it in GitHub Desktop.
bool firstTime = true;
class Vec2
{
public:
float x = 0.0f;
float y = 0.0f;
}
Vec2 coinPositions[10];
void Display()
{
if(firstTime)
{
for(int i = 0; i < 10; i++)
{
Vec2 coinPos;
coinPos.x = rand() % any_number;
coinPos.y = rand() % any_number;
coinPositions[i] = coinPos;
}
firstTime = false;
}
for(int i = 0; i < 10; i++)
{
drawCoin(coinPositions[i].x, coinPositions[i].y);
}
}
void drawCoin(float x, float y)
{
// Draw coin with random X and Y values
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment