small fix
This commit is contained in:
parent
eaba518ce4
commit
e1eb158f3f
1 changed files with 8 additions and 4 deletions
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
Game::Game()
|
Game::Game()
|
||||||
{
|
{
|
||||||
// advance simulation with 100 Hz
|
// advance simulation in fixed steps with 100 Hz
|
||||||
m_time_step = 1.0 / 100.0;
|
m_time_step = 1.0 / 100.0;
|
||||||
m_time_for_next_step = 0.0;
|
m_time_for_next_step = 0.0;
|
||||||
|
|
||||||
|
@ -24,6 +24,9 @@ Game::Game()
|
||||||
|
|
||||||
bool Game::cycle(float dt)
|
bool Game::cycle(float dt)
|
||||||
{
|
{
|
||||||
|
#if 1
|
||||||
|
// XXX the following is just testing code to do things
|
||||||
|
|
||||||
static float total = 0.0;
|
static float total = 0.0;
|
||||||
static float acc = 0.0;
|
static float acc = 0.0;
|
||||||
|
|
||||||
|
@ -36,18 +39,18 @@ bool Game::cycle(float dt)
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
acc += dt;
|
acc += dt;
|
||||||
total += dt;
|
total += dt;
|
||||||
|
|
||||||
float spawnInterval = 0.1;
|
float spawnInterval = 0.1;
|
||||||
while(acc > spawnInterval) {
|
while(acc > spawnInterval) {
|
||||||
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;
|
float speed = 0.005;
|
||||||
|
|
||||||
m_state->players[0]->addCommand(new game::SetSpeedCommand(speed));
|
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;
|
//static bool done = false;
|
||||||
//if (total >= 10.0 && !done) {
|
//if (total >= 10.0 && !done) {
|
||||||
|
@ -56,6 +59,7 @@ bool Game::cycle(float dt)
|
||||||
// m_state->players[0]->addCommand(new game::ClearTracesCommand());
|
// m_state->players[0]->addCommand(new game::ClearTracesCommand());
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//std::cout<<"adding dt: " << dt << std::endl;
|
//std::cout<<"adding dt: " << dt << std::endl;
|
||||||
m_time_for_next_step += dt;
|
m_time_for_next_step += dt;
|
||||||
|
|
Loading…
Reference in a new issue