void MapShowScene::update() { string temp; switch (mapShowState) { case MapShowState::GAME_RUNNING: bomberman.update(); enemies.update(); checkEnemies_Bomberman(); updateOffset(); if (bomb != nullptr) { bomb->update(); if (bomb->bombState == BombState::DESTROYED) { delete bomb; bomb = nullptr; } checkBomb_Char(); } else { const Uint8* currentKeyStates = SDL_GetKeyboardState(NULL); if (currentKeyStates[SDL_SCANCODE_SPACE]) { putBomb(); } } if ( SDL_GetTicks() - s_timeLeft > timeLeft ) { mapShowState = MapShowState::GAME_OVER; } temp = "Time Remaning : " + getString( ( timeLeft - SDL_GetTicks() + s_timeLeft ) / 1000 ); statusString.setText(temp.c_str()); break; case MapShowState::GAME_SUCCESS: break; case MapShowState::GAME_OVER: break; } }
void Marvin::onBombPressed(const gdl::Clock& clock) { putBomb(); }