void Deathmatch::init() { LoadingScreen load("CaveArenaMode"); load.updateValues(0); initializePlayers(); load.updateValues(50); initializeLevel(); load.updateValues(75); gameCore->resetCamera(1280.0f); Collider::getInstance()->setLevelLength(1280); Collider::getInstance()->setGameMode(gameCore->getCurrentGameMode()); inGameMenu = new Image::MenuSelection(); inGameMenu->setNewIdGameState(MainStates::STATE_ARENA_MODE); load.updateValues(100); }
void Game::step(Server & s) { switch (mState) { case Game::State::Waiting:// players clicked "ready" from lobby if (playersAreReady()) { sf::Packet * packet = new sf::Packet; *packet << Sv::LoadGame; pushPacket(nullptr, packet, true); unreadyPlayers(); //unready them so they can be ready to receive map data std::cout << "Game is starting!" << std::endl; mState = Game::State::Loading; } break; case Game::State::Loading: if (playersAreReady()) { std::string mapName = getRandomMap(); mGameWorld.loadMap(mapName); initializePlayers(); mState = Game::State::Playing; } break; case Game::State::Playing: mGameWorld.step(*this, s.TimeStep.asSeconds()); break; case Game::State::Ended: break; default: break; } }