/// <summary> /// Will add the given GhostFinderInterface as a Level to come after all of the previous levels /// Note this Function will only function. prior to GameWindow.setRunner() being called. calling afterwards will have no affect. /// </summary> /// <param name="nextLevel">The Level to Be added</param> /// <param name="name">the Level's name</param> /// <param name="WinMessage"></param> /// <param name="LoseMessage"></param> public void addLevel(GhostFinderInterface nextLevel, string name, string WinMessage, string LoseMessage) { if (tempList != null) { tempList.Enqueue(nextLevel); //name if (name != null) { tempNameList.Enqueue(name); } else { tempNameList.Enqueue("Level " + tempNameList.Count()); } //Win if (WinMessage != null) { tempWinList.Enqueue(WinMessage); } else { tempWinList.Enqueue("You Win"); } //Lose if (LoseMessage != null) { tempLoseList.Enqueue(LoseMessage); } else { tempLoseList.Enqueue("You Lose"); } //Setting first Level if (currentLevel == null) { currentLevel = nextLevel; } } }
/** * Conducts final initialization of gameplay objects including the current level * Required to begine a game */ internal void newGame(GhostFinderInterface userCode, int LevelNum) { //Background Music backGroundMusic.setVolume(0.1); this.setUpdateState(updateState.INGAME); currentLevel = userCode; LevelNumber = LevelNum; ((LevelButton)transitionMenue.getPanel(0)).setLevel(this, currentLevel, LevelNum); if (mainMenue.getPanel(2).getPanel(0).getPanel(LevelNum + 1) != null) { ((LevelButton)transitionMenue.getPanel(1)).setLevel(this, ((LevelButton)mainMenue.getPanel(2).getPanel(0).getPanel(LevelNumber + 1)).gameLevel, LevelNumber + 1); } else { ((LevelButton)transitionMenue.getPanel(1)).setLevel(this, null); } ((LevelButton)mainMenue.getPanel(0)).setLevel(this, userCode, LevelNum); //endGame(); setHeartHighlight(false); setHeartCount(4); //Enemies enemies.RemoveAllEnemies(); //Player player.setWidth(player.getHeight() / 2); player.setCenterY(BaseCode.worldHeight - (player.getHeight() / 2)); player.setCollumn(1); player.setEnemySet(enemies); player.visible = true; player.getLight().visible = true; BaseCode.activeDrawSet.addToDrawSet(player); player.setPriority(7); //powerBar powerBar.setSize(4.0f, 20.0f); powerBar.setCenter((BaseCode.worldWidth - (powerBar.getWidth()) / 2), (powerBar.getHeight() / 2) + 5f); powerBar.setMaxScore(10.0f); powerBar.setScore(0.0f); powerBar.setToVertical(); powerBar.setVisibility(true); BaseCode.activeDrawSet.addToDrawSet(powerBar); powerBar.setPriority(7); //Animation timer animationDelay = 30; //typeSelectedText typeSelectedText.textPosition.X = 1.0f; //typeSelectedText.textPosition.Y = 3.0f; typeSelectedText.text = ("Score: " + player.getScore()); typeSelectedText.visible = true; typeSelectedText.setPriority(7); userText.textPosition.X = 20f; //userText.textPosition.Y = 3.0f; userText.text = (""); userText.visible = true; //buttons //Reveal mediumButton.getBackGround().setSize(4f, 4f); mediumButton.getBackGround().setCenter(BaseCode.worldWidth - (mediumButton.getBackGround().getWidth() / 2), (BaseCode.worldHeight / 2)); mediumButton.setVisibility(true, true); mediumButton.setState(MenueSystem.Panel.PanelState.IDLE, true); mediumButton.setSparcleVisiblity(false); mediumButton.setPriority(7); BaseCode.activeDrawSet.addToDrawSet(mediumButton); //Wide wideButton.getBackGround().setSize(4f, 4f); wideButton.getBackGround().setCenter(BaseCode.worldWidth - (mediumButton.getBackGround().getWidth() / 2), (BaseCode.worldHeight / 2) + 5f); wideButton.setVisibility(true, true); wideButton.setState(MenueSystem.Panel.PanelState.IDLE, true); wideButton.setSparcleVisiblity(false); wideButton.setPriority(7); BaseCode.activeDrawSet.addToDrawSet(wideButton); //Laser laserButton.getBackGround().setSize(4f, 4f); laserButton.getBackGround().setCenter(BaseCode.worldWidth - (mediumButton.getBackGround().getWidth() / 2), (BaseCode.worldHeight / 2) + 10f); laserButton.setVisibility(true, true); laserButton.setState(MenueSystem.Panel.PanelState.IDLE, true); laserButton.setSparcleVisiblity(false); laserButton.setPriority(7); BaseCode.activeDrawSet.addToDrawSet(laserButton); player.setCollumn(0); if (userCode != null) { InteractableObject.setDefualtsToDefualts(); player.turnLightOnorOff(false); userCode.objectGrid.setObjectGrid(enemies.getGrid()); synkPlayerStateWithTrueState(); if (userCode.objectGrid != null) { userCode.objectGrid.reset(); } if (userCode.primitiveGrid != null) { userCode.primitiveGrid.reset(); } userCode.initialize(); synkTrueStateWithPlayerState(); userCode.light.updateMaxPosition(userCode.objectGrid.getObjectGrid()); StateChange change = enemies.synkGrid(userCode.objectGrid.getObjectGrid(), animationDelay); if (change != null && change.puaseForAnimation) { animationPuaseTimer = animationDelay; enemies.setEnemyAnimations(0); } } state = GameState.EndState.CONTINUE; }
/// <summary> /// Will add the given GhostFinderInterface as a Level to come after all of the previous levels. /// Note this Function will only function. prior to GameWindow.setRunner() being called. calling afterwards will have no affect. /// </summary> /// <param name="nextLevel">The Level to Be added</param> /// <param name="name">the Level's name</param> public void addLevel(GhostFinderInterface nextLevel, String name) { addLevel(nextLevel, name, null, null); }
public void setLevel(GhostFinder manager, GhostFinderInterface level, int LevelNum) { gameManager = manager; gameLevel = level; levelNumber = LevelNum; }