void lose() { REG_DISPCTL = MODE4 | BG2_ENABLE; loadPalette(gameover_screenPal); drawBackgroundImage4(gameover_screenBitmap); while (1) { oldButtons = buttons; buttons = BUTTONS; if (BUTTON_PRESSED(BUTTON_A)) { init(); setupLevel(); state = GAME; return; } if (BUTTON_PRESSED(BUTTON_SELECT)) { playSoundB(menuSound, MENUSOUNDLEN, MENUSOUNDFREQ, 0); playSoundA(titleSong, TITLESONGLEN, TITLESONGFREQ, 1); state = SPLASH; return; } } }
void Manager::setup(const std::string & expr) { std::string::size_type dp = expr.find('.'); if(dp == std::string::npos) BOOST_THROW_EXCEPTION(ManagerException() << mstd::error_message("Invalid setup syntax - '.' expected")); std::string::size_type ep = expr.find('=', dp); if(ep == std::string::npos) BOOST_THROW_EXCEPTION(ManagerException() << mstd::error_message("Invalid setup syntax - '=' expected")); std::string name = expr.substr(0, dp); boost::trim(name); std::string prop = expr.substr(dp + 1, ep - dp - 1); boost::trim(prop); std::string value = expr.substr(ep + 1); boost::trim(value); boost::mutex::scoped_lock lock(mutex_); if(name == "device") setupDevice(prop, value, lock); else if(name == "manager") { if(prop == "realtime") realtime_ = value == "1" || value == "true"; } else if(prop == "level") setupLevel(name, value, lock); else if(prop == "group") setupGroup(name, value, lock); else BOOST_THROW_EXCEPTION(ManagerException() << mstd::error_message("Unknown command: " + expr)); }
//-------------------------------------------------------------- void ofApp::reset(){ scrollPos.set(0,0); scrollTarget = scrollPos; //player.setup(); setupNewGameObject(&player); setupLevel(); }
// Setting up the game from the beginning (splash screen -> level 0) void setupGame() { state = SPLASH; season = NEUTRAL; currentLevel = 1; setupLevel(); }
void StateLevel::init() { // Setup callbacks to user input setupInput(); // Setup message callbacks setupMessages(); // Setup level scene nodes setupScene(); setupLevel(); setupTrackers(); m_waveManager.setup( GAME_MANAGER.getLevelData() ); m_waveManager.start(); m_iKeyEscape = INPUT_MANAEGER.addCallback( InputManager::Event_KeyUp, sf::Keyboard::Escape, [this](){ MSG_SYSTEM.sendPost( c_msgStateChange, StateType::State_map ); } ); }
void winLevel() { REG_DISPCTL = MODE4 | BG2_ENABLE; loadPalette(win_level_screenPal); drawBackgroundImage4(win_level_screenBitmap); while (1) { oldButtons = buttons; buttons = BUTTONS; if (BUTTON_PRESSED(BUTTON_A)) { if (currentLevel + 1 <= NUMLEVELS) { currentLevel++; init(); setupLevel(); state = GAME; } else { state = GAMEEND; } return; } if (BUTTON_PRESSED(BUTTON_SELECT)) { playSoundB(menuSound, MENUSOUNDLEN, MENUSOUNDFREQ, 0); playSoundA(titleSong, TITLESONGLEN, TITLESONGFREQ, 1); state = SPLASH; return; } } }
Level::Level(MainScene* scene) { setupLevel(scene); }