Skip to content

Commit

Permalink
Improve random spawn of asteroids
Browse files Browse the repository at this point in the history
  • Loading branch information
FoolHen committed Feb 25, 2017
1 parent ef78b92 commit b35142b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Engine/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ Game::Game( MainWindow& wnd )
explosionSound( L"explosion.wav"),
gameoverSound( L"collision.wav"),
coinSound( L"coin.wav"),
music( L"music.wav",0.0f, 6.0f) //6.857142f
music( L"music.wav",0.0f, 6.0f), //6.857142f is the end of the file, but it makes a weird loop
rng( rd() )
{
}

Expand Down Expand Up @@ -117,7 +118,7 @@ void Game::UpdateModel()
{
lasers[j].SetIsUsed(false);
score++;
asteroids[i].Spawn( rng, gfx, ship);
asteroids[i].Spawn( rng , gfx, ship);
explosionSound.Play();
coinSound.Play(1.0f,0.5f);
}
Expand Down
1 change: 1 addition & 0 deletions Engine/Game.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class Game
FrameTimer spaceBarCooldown;
Asteroid asteroids[nAsteroids];
Laser lasers[maxLaser];
std::random_device rd;
std::mt19937 rng;
bool isShipAcc = false;
bool gameOver = true;
Expand Down

0 comments on commit b35142b

Please sign in to comment.