small fix

This commit is contained in:
Andreas Ortmann 2016-09-27 23:16:25 +02:00
parent eaba518ce4
commit e1eb158f3f

View file

@ -8,7 +8,7 @@
Game::Game()
{
// advance simulation with 100 Hz
// advance simulation in fixed steps with 100 Hz
m_time_step = 1.0 / 100.0;
m_time_for_next_step = 0.0;
@ -24,6 +24,9 @@ Game::Game()
bool Game::cycle(float dt)
{
#if 1
// XXX the following is just testing code to do things
static float total = 0.0;
static float acc = 0.0;
@ -36,18 +39,18 @@ bool Game::cycle(float dt)
// }
//}
acc += dt;
acc += dt;
total += dt;
float spawnInterval = 0.1;
while(acc > spawnInterval) {
acc -= spawnInterval;
float a = 2.0 * M_PI * util::randf_0_1();
float angle = 2.0 * M_PI * util::randf_0_1();
float speed = 0.005;
m_state->players[0]->addCommand(new game::SetSpeedCommand(speed));
m_state->players[0]->addCommand(new game::ShootCommand(a));
m_state->players[0]->addCommand(new game::ShootCommand(angle));
//static bool done = false;
//if (total >= 10.0 && !done) {
@ -56,6 +59,7 @@ bool Game::cycle(float dt)
// m_state->players[0]->addCommand(new game::ClearTracesCommand());
//}
}
#endif
//std::cout<<"adding dt: " << dt << std::endl;
m_time_for_next_step += dt;