From e1eb158f3f1e59856123dc2a5bbd5079bce0b756 Mon Sep 17 00:00:00 2001 From: Andreas Ortmann Date: Tue, 27 Sep 2016 23:16:25 +0200 Subject: [PATCH] small fix --- game/game.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/game/game.cpp b/game/game.cpp index 128cdca..b0b590b 100644 --- a/game/game.cpp +++ b/game/game.cpp @@ -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;