static void logic(void) { handleKeyboard(); scrollBackground(-0.25, 0); doStars(0.5, 0); planet.x -= 0.25; if (planet.x <= -200) { planet.x = SCREEN_WIDTH + 128 + (rand() % SCREEN_WIDTH); planet.y = (rand() % SCREEN_HEIGHT - 128); } switch (show) { case SHOW_CHALLENGES: doChallenges(); break; case SHOW_MENU: break; case SHOW_STATS: break; case SHOW_OPTIONS: break; } doWidgets(); app.doTrophyAlerts = 1; }
static void logic(void) { handleKeyboard(); scrollBackground(0, 0.25); doStars(0, -0.5); earth.y += 0.1; if (earth.y > SCREEN_HEIGHT + 128) { earth.x = rand() % SCREEN_WIDTH; earth.y = -(128 + (rand() % 128)); } doFighters(); doEffects(); app.doTrophyAlerts = 1; if (show == SHOW_FIGHTER_DB) { doFighterDatabase(); } doWidgets(); }
void MicroRace::update( float elapsedTime ) { speed += 0.002f * elapsedTime * 60.0f; gameTime += elapsedTime; scrollBackground(elapsedTime); for(auto p : players) { p->update(players, elapsedTime, speed, cars); }; for(auto c : cars) { c->update(elapsedTime, speed); }; if(blib::math::randomDouble() < spawnFactor * 0.01 * (1+(speed-1) * 0.9f) * elapsedTime*60) spawnCar(gameTime); blib::linq::deletewhere(cars, [] (Car* c) { return c->position.x < 0; }); }
static void logic(void) { handleKeyboard(); scrollBackground(0, 0.25); doStars(0, -0.5); earth.y += 0.1; if (earth.y > SCREEN_HEIGHT + 128) { earth.x = rand() % SCREEN_WIDTH; earth.y = -(128 + (rand() % 128)); } doFighters(); doEffects(); doWidgets(); }