void Levelwin() { Terminal.ClearScreen(); currentscreen = screen.winscreen; Levelreward(); Terminal.WriteLine(menuhint); }
void askforpassword() { currentscreen = screen.password; Terminal.ClearScreen(); setrandompassword(); Terminal.WriteLine("enter your password, hint:" + password.Anagram()); }
private void drawReadyScreen() { playSound(readySound); lblTitle.Text = "Question " + questions[questionIndex].questionNumber.ToString(); lblMainBoxLabel.Text = "Ready?"; lblPoints.Text = questions[questionIndex].points.ToString(); lblSeconds.Text = questions[questionIndex].time.ToString(); hideMarks(); lockKeyboard(); foreach (Team team in this.teams) { highlightTeam(team, false); } try { this.BackgroundImage = Image.FromFile("Resources\\Ready.png"); } catch (Exception) { }; screenShowing = screen.ready; lblTitle.Hide(); lblPoints.Hide(); lblPointsLabel.Hide(); lblSeconds.Hide(); lblSecondsLabel.Hide(); }
public void Change(screen _screen) { if (currentScreen == _screen) { return; } ScreenObject obj = Screens.Find(x => x.sceen == _screen); if (obj != null) { foreach (var i in Screens) { foreach (var j in i.objects) { j.SetActive(false); } } currentScreen = _screen; foreach (var i in obj.objects) { i.SetActive(true); } } }
public ChatScreen(string info) { InitializeComponent(); screen chatscreen = new screen(info); panel1.Controls.Add(chatscreen); }
void startgame() { currentscreen = screen.password; Terminal.ClearScreen(); Terminal.WriteLine("you have chosen level:" + level); askpassword(); }
public chatbox2(string username, string contact, screen parent) { InitializeComponent(); this.username = username; this.contact = contact; this.parent = parent; }
void DisplayFailScreen() { currentScreen = screen.Caught; Terminal.ClearScreen(); Terminal.WriteLine("Unauthorized Access Attempts Detected!"); Terminal.WriteLine("The authorities have been alerted!!!!!!"); Terminal.WriteLine("Tracing has begun... CUT TAIL AND RUN!!"); }
void DisplayWinScreen() { currentScreen = screen.Win; Terminal.ClearScreen(); Terminal.WriteLine("Connected to the " + levelNames[(level - 1)]); ShowLevelReward(); Terminal.WriteLine(exitHint); }
void AskForPassword(int attemptsLeft) { currentScreen = screen.Password; Terminal.ClearScreen(); Terminal.WriteLine(attemptsLeft + " Attept(s) left to access " + levelNames[(level - 1)]); Terminal.WriteLine("enter password, hint: " + password.Anagram()); Terminal.WriteLine(exitHint); }
// Start is called before the first frame update void Start() { currentScreen = screen.Title; titlePanel.SetActive(true); menuPanel.SetActive(false); currentMenuChoice = menuChoices.saveFileOne; }
void ShowGuessingScreen() { CurrentScreen = screen.Guessing; Terminal.ClearScreen(); Terminal.WriteLine("You can get back to menu any time\nby tiping: menu"); Terminal.WriteLine("Your hint is: " + Password.Anagram()); Terminal.WriteLine("Enter Password:"); }
internal unsafe bool IsFullScreen_(out screen scrn) { scrn = default; if (Is0) { return(false); } //is client rect equal to window rect (no border)? RECT r, rc, rm; r = Rect; //fast int cx = r.right - r.left, cy = r.bottom - r.top; if (cx < 400 || cy < 300) { return(false); //too small } rc = ClientRect; //fast if (rc.right != cx || rc.bottom != cy) { if (cx - rc.right > 2 || cy - rc.bottom > 2) { return(false); //some windows have 1-pixel border } } //covers whole screen rect? scrn = screen.of(this, SODefault.Zero); if (scrn.IsEmpty) { return(false); } rm = scrn.Rect; if (r.left > rm.left || r.top > rm.top || r.right < rm.right || r.bottom < rm.bottom - 1) { return(false); //info: -1 for inactive Chrome } //is it desktop? if (IsOfShellThread_) { return(false); } if (this == getwnd.root) { return(false); } return(true); //This is the best way to test for fullscreen (FS) window. Fast. //Window and client rect was equal of almost all my tested FS windows. Except Winamp visualization. //Most FS windows are same size as screen, but some slightly bigger. //Don't look at window styles. For some FS windows they are not as should be. //Returns false if the active window is owned by a fullscreen window. This is different than appbar API interprets it. It's OK for our purposes. }
void Startgame() { Terminal.ClearScreen(); currentscreen = screen.password; setrandompassword(); Terminal.WriteLine("Please enter the password,Hint: " + password.Anagram()); Terminal.WriteLine(menuhint); }
void ShowMainMenuScreen(string Greeting) { CurrentScreen = screen.MainMenu; Terminal.ClearScreen(); Terminal.WriteLine(Greeting + "\nChoose a place where to hack:"); Terminal.WriteLine("Press 1 for McDonalds"); Terminal.WriteLine("Press 2 for Sony"); Terminal.WriteLine("Press 3 for White house office"); Terminal.WriteLine("Enter your selection:"); }
void ShowMainMenu(string tagline) { currentScreen = screen.MainMenu; Terminal.ClearScreen(); Terminal.WriteLine(tagline); Terminal.WriteLine("\nBeware, using this program is illegal in 48 states!"); Terminal.WriteLine("Select from Access Menu:"); Terminal.WriteLine("1- The Kitchen"); Terminal.WriteLine("2- The Sound System"); Terminal.WriteLine("3- The Smart-Home Core System"); }
void Showmainmenu() { currentscreen = screen.mainmenu; Terminal.ClearScreen(); Terminal.WriteLine("Welcome to the game of hacking!! "); Terminal.WriteLine("press 1 to hack Real Madrid"); Terminal.WriteLine("press 2 to hack ISRO"); Terminal.WriteLine("press 3 to hack KIAL"); Terminal.WriteLine(""); Terminal.WriteLine("Enter Your Choice"); }
void ShowMainMenu() { currentscreen = screen.mainmenu; Terminal.ClearScreen(); Terminal.WriteLine("What would you like to hack into?"); Terminal.WriteLine("Press 1 for the local library"); Terminal.WriteLine("Press 2 for the local police station"); Terminal.WriteLine("you can type menu to return back to the main menu at any point in the game"); Terminal.WriteLine("Enter your selection:"); }
private void drawAnswerScreen() { lblTitle.Text = "Answer " + questions[questionIndex].questionNumber.ToString(); lblMainBoxLabel.Text = questions[questionIndex].strAnswer; hideMarks(); screenShowing = screen.answer; lockKeyboard(); lblTitle.Show(); lblPoints.Show(); lblPointsLabel.Show(); lblSeconds.Show(); lblSecondsLabel.Show(); }
void ShowWinScreen() { CurrentScreen = screen.Win; Terminal.ClearScreen(); switch (Level) { case 1: Terminal.WriteLine("Access granted! Good job fat boy!"); //Ascii art from external sorce: http://www.qqpr.com/ascii-art-food-2.html Terminal.WriteLine(@" \\|\|//||/// _..----.._ |\/\||//|||| .' o '. |||\\|/\\ || / o o \ | './\_/.' | |o o o| | .:. .:. | /'-.._o __.-'\ | : :: : | \ ````` / | : '' : | |``--........--'`| '.______.' \ / `'----------'`"); break; case 2: //Ascii art from external sorce: http://ascii.co.uk/art/playstation Terminal.WriteLine(@"Access granted! Enjoy your game ;) _____________________ | |,` `.| | | / SONY \ | | O _ \ /> / _ | ______ | _(_)'.____.'(_)_ | (°)__(°) [_____ |[=]__[=] | ___] // \\"); break; case 3: Terminal.WriteLine("Access granted! Wanna build that wall?"); //Ascii art from external sorce: https://www.oocities.org/spunk1111/july4.htm Terminal.WriteLine(@" 9::::======= |::::======= |=========== |=========== | "); break; default: Debug.LogError("Something went wrong in ShowWinScreen() "); break; } }
private void drawErrorScreen() { lblTitle.Text = "Error"; lblMainBoxLabel.Text = "Error Reading Questions File"; lblPoints.Text = "---"; lblSeconds.Text = "--"; screenShowing = screen.error; lockKeyboard(); lblTitle.Show(); lblPoints.Show(); lblPointsLabel.Show(); lblSeconds.Show(); lblSecondsLabel.Show(); }
public void prepNewTerrain(screen scr = screen.LEVEL1) { Random random = new Random(); stop = false; curScreen = scr; lines.Clear(); vertexList.Clear(); indexList.Clear(); polygonPoints.Clear(); vertexTri = new VertexPositionColor[] { }; indexTri = new int[] { }; transitionTime = 0; landingZone1.point1 = new Point(); landingZone1.point2 = new Point(); landingZone2.point1 = new Point(); landingZone2.point2 = new Point(); lander = new Lander(); lander.position = new Vector2(random.Next((int)(screenWidth * 0.15), (int)(screenWidth * 0.85)), (float)(screenHeight * 0.1)); lander.velocity = 0; lander.fuel = scr == screen.LEVEL1 ? 100 : 50; lander.angle = (float)random.Next(0, 6); winner = false; crashed = false; gravitationalForce = 0; horizontalMomentum = 0; lastIteration = DateTime.Now; particleEmitterSmoke = new ParticleEmitter( Content, new TimeSpan(0, 0, 0, 0, 2), (int)lander.position.X, (int)lander.position.Y, 20, 200, new TimeSpan(0, 0, 2), new TimeSpan(0, 0, 0, 3000)); particleEmitterFire = new ParticleEmitter( Content, new TimeSpan(0, 0, 0, 0, 10), (int)lander.position.X, (int)lander.position.Y, 40, 300, new TimeSpan(0, 0, 0, 0, 1000), new TimeSpan(0, 0, 0, 0, 800)); }
void Awake() { InitDic(); s = new Stack <screen>(); MainGame.SetActive(false); curr = screen.Login; if (listen == null) { listen = new Listener(); } UiObjects["Main_Menu"].SetActive(false); UiObjects["Loading"].SetActive(false); UiObjects["Menu_Multi"].SetActive(false); UiObjects["Menu_Single"].SetActive(false); UiObjects["Options"].SetActive(false); UiObjects["Stud_Menu"].SetActive(false); }
void TransitionScreen(screen newScreen) { if (newScreen == screen.Menu) { titlePanel.SetActive(false); menuPanel.SetActive(true); currentMenuChoice = menuChoices.saveFileOne; } if (newScreen == screen.Title) { titlePanel.SetActive(true); menuPanel.SetActive(false); } currentScreen = newScreen; }
public void MakeSpriteOuttaVertices(Vector2[] vertices) { //v = vertices; width = Screen.width / divider; height = Screen.height / divider; print(width); print(height); float camSize = Camera.main.orthographicSize; screen theScreen = new screen(width, height); // Create a new 2x2 texture ARGB32 (32 bit with alpha) and no mipmaps Texture2D texture = new Texture2D(width, height, TextureFormat.ARGB32, false); // set the pixel values for (int i = 0; i < height; i++) { for (int j = 0; j < width; j++) { if (checkPoint(vertices, j, i)) { theScreen.setColor(j, i, Color.white); } else { theScreen.setColor(j, i, Color.clear); } } } texture.SetPixels(theScreen.colors); // Apply all SetPixel calls texture.Apply(); Sprite s = Sprite.Create(texture, new Rect(0, 0, width, height), new Vector2(0.5f, 0.5f), height / (camSize * 2)); GetComponent <SpriteMask>().sprite = s; }
void OnUserInput(string input) { if (input == "menu") { currentscreen = screen.mainmenu; Showmainmenu(); } else if (input == "exit" || input == "close" || input == "quit") { Application.Quit(); } else if (currentscreen == screen.mainmenu) { runmainmenu(input); } else if (currentscreen == screen.password) { Checkpassword(input); } }
private void drawEndScreen() { playSound(gameOverSound); screenShowing = screen.end; lblMainBoxLabel.Text = "Game Over"; hideMarks(); foreach (Team team in this.teams) { highlightTeam(team, false); } var noNulls = this.teams.Where(x => x != null).Select(x => x); var maxPoints = noNulls.Max(x => x.points); var winners = noNulls.Where(x => x.points == maxPoints).Select(x => x); if (maxPoints <= 0) { lblMainBoxLabel.Text += "\n\nNo Winners"; } else { string winnersString = ""; int i = 0; foreach (var team in winners) { highlightTeam(team, true); winnersString += (i++ == 0?"":", ") + team.teamName; } lblMainBoxLabel.Text += "\n\nCongratulations!\n" + winnersString; } try { this.BackgroundImage = Image.FromFile("Resources\\GameOver.png"); } catch (Exception) { }; lockKeyboard(); lblTitle.Hide(); lblPoints.Hide(); lblPointsLabel.Hide(); lblSeconds.Hide(); lblSecondsLabel.Hide(); }
void winscreen() { currentscreen = screen.win; Terminal.ClearScreen(); Terminal.WriteLine(menuhint); Terminal.WriteLine("you have hacked into system"); switch (level) { case 1: Terminal.WriteLine("\n grades changed"); Terminal.WriteLine(@" ________ | _ + | | /_\ | | / \ | |________| "); break; case 2: Terminal.WriteLine("\n privacy stolen"); Terminal.WriteLine(@" _____ | 0 0 | \ * / \###/ HACKED "); break; case 3: Terminal.WriteLine(" \n immortal power"); Terminal.WriteLine(@" ________________ |________________| . . . | |__(_| |___| "); break; } }
void OnUserInput(string input) { if (input == "menu") { showmenu(); currentscreen = screen.mainmenu; } else if (input == "exit") { Terminal.WriteLine("if in web close the TAB"); Application.Quit(); } else if (currentscreen == screen.mainmenu) { runmainmenu(input); } else if (currentscreen == screen.password) { checkpassword(input); } }
public Game1() { polygonPoints = new List <Point>(); collisionPoint = new Point(); keyPressed = false; winner = false; stop = false; emitParticles = false; themePlaying = false; crashed = false; changingKey = false; lander = new Lander(); lines = new List <Point>(); vertexList = new List <VertexPositionColor>(); indexList = new List <int>(); soundEffects = new List <SoundEffect>(); _graphics = new GraphicsDeviceManager(this); _graphics.IsFullScreen = true; _graphics.PreferredBackBufferWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width; _graphics.PreferredBackBufferHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height; _graphics.ApplyChanges(); curScreen = screen.MAIN; Content.RootDirectory = "Content"; IsMouseVisible = true; s = 0.2; landingZoneWidth = 100; gravitationalForce = 0; horizontalMomentum = 0; screenWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width; screenHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height; random = new Random(); LoadKeys(); LoadScores(); rotLeft = KeyConfig[1]; rotRight = KeyConfig[2]; thrust = KeyConfig[0]; myMenu = new Menu(Content, screenWidth, screenHeight, thrust, rotRight, rotLeft); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); //Main menu mainMenu = new SimpleTexture(Content.Load<Texture2D>(@"Images\MenuPictures\MainMenu"),new Rectangle(), Vector2.Zero ); //Help help = new SimpleTexture(Content.Load<Texture2D>(@"Images\MenuPictures\Help"), new Rectangle(), Vector2.Zero); //Credits credits = new SimpleTexture(Content.Load<Texture2D>(@"Images\MenuPictures\Credits"), new Rectangle(), Vector2.Zero); //win win = new SimpleTexture(Content.Load<Texture2D>(@"Images\MenuPictures\Win"), new Rectangle(), Vector2.Zero); //fail fail = new SimpleTexture(Content.Load<Texture2D>(@"Images\MenuPictures\Fail"), new Rectangle(), Vector2.Zero); //nextLeve nextLevel = new SimpleTexture(Content.Load<Texture2D>(@"Images\MenuPictures\NextLevel"), new Rectangle(), Vector2.Zero); //map1 map1Background = new SimpleTexture(Content.Load<Texture2D>(@"Images\MapBackgrounds\map1"), new Rectangle(), Vector2.Zero); //map2 map2Background = new SimpleTexture(Content.Load<Texture2D>(@"Images\MapBackgrounds\map4"), new Rectangle(), Vector2.Zero); //map3 map3Background = new SimpleTexture(Content.Load<Texture2D>(@"Images\MapBackgrounds\map8"), new Rectangle(), Vector2.Zero); //map4 map4Background = new SimpleTexture(Content.Load<Texture2D>(@"Images\MapBackgrounds\map6"), new Rectangle(), Vector2.Zero); //map5 map5Background = new SimpleTexture(Content.Load<Texture2D>(@"Images\MapBackgrounds\map10"), new Rectangle(), Vector2.Zero); //crosshair crosshair = new SimpleTexture(Content.Load<Texture2D>(@"Images\Others\Crosshair"), new Rectangle(), new Vector2(800, 520)); //pause pauseBackground = new SimpleTexture(Content.Load<Texture2D>(@"Images\MenuPictures\pauseMenu"), new Rectangle(), Vector2.Zero); //arrow arrowLevel1 = new Arrow(Content.Load<Texture2D>(@"Images\Others\Arrow"), new Rectangle(), new Vector2(2000, 620), 5f); arrowLevel2 = new Arrow(Content.Load<Texture2D>(@"Images\Others\Arrow"), new Rectangle(), new Vector2(2000, 620), 5f); arrowLevel3 = new Arrow(Content.Load<Texture2D>(@"Images\Others\Arrow"), new Rectangle(), new Vector2(2000, 620), 5f); arrowLevel4 = new Arrow(Content.Load<Texture2D>(@"Images\Others\Arrow"), new Rectangle(), new Vector2(2000, 620), 7f); arrowLevel5 = new Arrow(Content.Load<Texture2D>(@"Images\Others\Arrow"), new Rectangle(), new Vector2(2000, 620), 10f); //level2 //bomb Level2Bombs[0] = new bomb(Content.Load<Texture2D>(@"Images\Others\bomb"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); Level2Bombs[1] = new bomb(Content.Load<Texture2D>(@"Images\Others\bomb"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); Level2Bombs[2] = new bomb(Content.Load<Texture2D>(@"Images\Others\bomb"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); //health Level2Health[0] = new Health(Content.Load<Texture2D>(@"Images\Others\health"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); Level2Health[1] = new Health(Content.Load<Texture2D>(@"Images\Others\health"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); Level2Health[2] = new Health(Content.Load<Texture2D>(@"Images\Others\health"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); //level3 //bomb Level3Bombs[0] = new bomb(Content.Load<Texture2D>(@"Images\Others\bomb"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); Level3Bombs[1] = new bomb(Content.Load<Texture2D>(@"Images\Others\bomb"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); Level3Bombs[2] = new bomb(Content.Load<Texture2D>(@"Images\Others\bomb"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); Level3Bombs[3] = new bomb(Content.Load<Texture2D>(@"Images\Others\bomb"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); //health Level3Health[0] = new Health(Content.Load<Texture2D>(@"Images\Others\health"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); Level3Health[1] = new Health(Content.Load<Texture2D>(@"Images\Others\health"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); Level3Health[2] = new Health(Content.Load<Texture2D>(@"Images\Others\health"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); Level3Health[3] = new Health(Content.Load<Texture2D>(@"Images\Others\health"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); //level4 //bomb Level4Bombs[0] = new bomb(Content.Load<Texture2D>(@"Images\Others\bomb"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); Level4Bombs[1] = new bomb(Content.Load<Texture2D>(@"Images\Others\bomb"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); Level4Bombs[2] = new bomb(Content.Load<Texture2D>(@"Images\Others\bomb"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); Level4Bombs[3] = new bomb(Content.Load<Texture2D>(@"Images\Others\bomb"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); //health Level4Health[0] = new Health(Content.Load<Texture2D>(@"Images\Others\health"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); Level4Health[1] = new Health(Content.Load<Texture2D>(@"Images\Others\health"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); Level4Health[2] = new Health(Content.Load<Texture2D>(@"Images\Others\health"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); Level4Health[3] = new Health(Content.Load<Texture2D>(@"Images\Others\health"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); Level4Health[4] = new Health(Content.Load<Texture2D>(@"Images\Others\health"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); //level5 //bomb Level5Bombs[0] = new bomb(Content.Load<Texture2D>(@"Images\Others\bomb"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); Level5Bombs[1] = new bomb(Content.Load<Texture2D>(@"Images\Others\bomb"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); Level5Bombs[2] = new bomb(Content.Load<Texture2D>(@"Images\Others\bomb"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); Level5Bombs[3] = new bomb(Content.Load<Texture2D>(@"Images\Others\bomb"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); Level5Bombs[4] = new bomb(Content.Load<Texture2D>(@"Images\Others\bomb"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); //health Level5Health[0] = new Health(Content.Load<Texture2D>(@"Images\Others\health"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); Level5Health[1] = new Health(Content.Load<Texture2D>(@"Images\Others\health"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); Level5Health[2] = new Health(Content.Load<Texture2D>(@"Images\Others\health"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); Level5Health[3] = new Health(Content.Load<Texture2D>(@"Images\Others\health"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); Level5Health[4] = new Health(Content.Load<Texture2D>(@"Images\Others\health"), new Rectangle(), new Vector2(random.Next(0, 1280), -100), 3f); //baloongs //Level1Baloons[0] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Yellow"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0,360)), 3f); //Level1Baloons[1] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Red"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); //Level1Baloons[2] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Orange"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); //Level1Baloons[3] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Pink"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); //Level1Baloons[4] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Purple"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level1Baloons[0] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Yellow"), new Rectangle(), new Vector2(0, random.Next(0, 360)), 3f); Level1Baloons[1] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Red"), new Rectangle(), new Vector2(256, random.Next(0, 360)), 3f); Level1Baloons[2] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Orange"), new Rectangle(), new Vector2(512, random.Next(0, 360)), 3f); Level1Baloons[3] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Pink"), new Rectangle(), new Vector2(768, random.Next(0, 360)), 3f); Level1Baloons[4] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Purple"), new Rectangle(), new Vector2(1024, random.Next(0, 360)), 3f); Level2Baloons[0] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Purple"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level2Baloons[1] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Pink"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level2Baloons[2] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Red"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level2Baloons[3] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Black"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level2Baloons[4] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Yellow"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level2Baloons[5] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Blue"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level2Baloons[6] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Brown"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level2Baloons[7] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Maroon"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level3Baloons[0] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Purple"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level3Baloons[1] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Pink"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level3Baloons[2] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Red"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level3Baloons[3] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Black"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level3Baloons[4] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Yellow"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level3Baloons[5] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Blue"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level3Baloons[6] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Brown"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level3Baloons[7] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Maroon"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level3Baloons[8] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Orange"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level3Baloons[9] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Pink"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); //Level4 Death baloons Level4DeathBaloons[0] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\One1"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level4DeathBaloons[1] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\One"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level4DeathBaloons[2] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\One1"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level4Baloons[0] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Purple"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level4Baloons[1] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Pink"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level4Baloons[2] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Red"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level4Baloons[3] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Black"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level4Baloons[4] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Yellow"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level4Baloons[5] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Blue"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level4Baloons[6] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Brown"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level4Baloons[7] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Maroon"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level4Baloons[8] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Orange"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level4Baloons[9] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Pink"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level4Baloons[10] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Blue"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level4Baloons[11] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Brown"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); //Level5 Death baloons Level5DeathBaloons[0] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Two"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level5DeathBaloons[1] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Two1"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level5DeathBaloons[2] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Two"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level5DeathBaloons[3] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Two1"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level5DeathBaloons[4] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Two"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level5Baloons[0] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Purple"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level5Baloons[1] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Pink"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level5Baloons[2] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Red"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level5Baloons[3] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Black"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level5Baloons[4] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Yellow"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level5Baloons[5] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Blue"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level5Baloons[6] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Brown"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level5Baloons[7] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Maroon"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level5Baloons[8] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Orange"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level5Baloons[9] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Pink"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level5Baloons[10] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Blue"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level5Baloons[11] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Brown"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level5Baloons[12] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Maroon"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level5Baloons[13] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Orange"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); Level5Baloons[14] = new Baloon(Content.Load<Texture2D>(@"Images\Baloons\Pink"), new Rectangle(), new Vector2(random.Next(0, 1280), random.Next(0, 360)), 3f); //fonts myFont = Content.Load<SpriteFont>(@"Font\myFont"); myFont1 = Content.Load<SpriteFont>(@"Font\myFont"); myFont2 = Content.Load<SpriteFont>(@"Font\myFont"); myFont3 = Content.Load<SpriteFont>(@"Font\myFont"); myFont4 = Content.Load<SpriteFont>(@"Font\myFont"); //audio audioEngine = new AudioEngine(@"Content\Audio\GameAudio.xgs"); waveBank = new WaveBank(audioEngine, @"Content\Audio\Wave Bank.xwb"); soundBank = new SoundBank(audioEngine, @"Content\Audio\Sound Bank.xsb"); backgroundMusic = soundBank.GetCue("Background"); backgroundMusic.Play(); currentScreen = screen.Mainmenu; }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) this.Exit(); if (currentKeyboardState.IsKeyDown(Keys.Q)) this.Exit(); lastKeyboardState = currentKeyboardState; currentKeyboardState = Keyboard.GetState(); switch (currentScreen) { case screen.Mainmenu: { mainMenu.Update(); //set level data Level1ArrowCount = 10; score = 0; timeforLevel1 = 70; for (int x = 0; x < 5; x++) Level1Baloons[x].doUpdate = true; Level2ArrowCount = 13; score1 = 0; timeforLevel2 = 60; for (int x = 0; x < 8; x++) Level2Baloons[x].doUpdate = true; Level3ArrowCount = 15; score2 = 0; timeforLevel3 = 50; for (int x = 0; x < 10; x++) Level3Baloons[x].doUpdate = true; Level4ArrowCount = 17; score3 = 0; timeforLevel4 = 40; for (int x = 0; x < 12; x++) Level4Baloons[x].doUpdate = true; Level5ArrowCount = 20; score4 = 0; timeforLevel5 = 30; for (int x = 0; x < 15; x++) Level5Baloons[x].doUpdate = true; Level1Baloons[0].position= new Vector2(0, random.Next(0,360)); Level1Baloons[1].position = new Vector2(256, random.Next(0, 360)); Level1Baloons[2].position = new Vector2(512, random.Next(0, 360)); Level1Baloons[3].position = new Vector2(768, random.Next(0, 360)); Level1Baloons[4].position = new Vector2(1024, random.Next(0, 360)); //end set //start game if ((currentKeyboardState.IsKeyDown(Keys.Enter) && lastKeyboardState.IsKeyUp(Keys.Enter))) { setCurrentScrren = 1; KeyPress = soundBank.GetCue("KeyPress"); KeyPress.Play(); currentScreen = screen.Map1; } //show help if ((currentKeyboardState.IsKeyDown(Keys.F1) && lastKeyboardState.IsKeyUp(Keys.F1))) { KeyPress = soundBank.GetCue("KeyPress"); KeyPress.Play(); currentScreen = screen.Help; } //show credits if ((currentKeyboardState.IsKeyDown(Keys.F2) && lastKeyboardState.IsKeyUp(Keys.F2))) { KeyPress = soundBank.GetCue("KeyPress"); KeyPress.Play(); currentScreen = screen.Credits; } break; } case screen.Help: { help.Update(); //go back if ((currentKeyboardState.IsKeyDown(Keys.Escape) && lastKeyboardState.IsKeyUp(Keys.Escape))) { KeyPress = soundBank.GetCue("KeyPress"); KeyPress.Play(); currentScreen = screen.Mainmenu; } break; } case screen.Credits: { credits.Update(); //go back if ((currentKeyboardState.IsKeyDown(Keys.Escape) && lastKeyboardState.IsKeyUp(Keys.Escape))) { KeyPress = soundBank.GetCue("KeyPress"); KeyPress.Play(); currentScreen = screen.Mainmenu; } break; } case screen.Win: { win.Update(); if (WinOncePlay) { Win = soundBank.GetCue("Win"); Win.Play(); WinOncePlay = false; } if ((currentKeyboardState.IsKeyDown(Keys.Enter) && lastKeyboardState.IsKeyUp(Keys.Enter))) { currentScreen = screen.Mainmenu; } break; } case screen.Fail: { Level1Baloons[0].position = new Vector2(0, random.Next(0, 360)); Level1Baloons[1].position = new Vector2(256, random.Next(0, 360)); Level1Baloons[2].position = new Vector2(512, random.Next(0, 360)); Level1Baloons[3].position = new Vector2(768, random.Next(0, 360)); Level1Baloons[4].position = new Vector2(1024, random.Next(0, 360)); fail.Update(); if (FailOncePlay) { Fail = soundBank.GetCue("Fail"); Fail.Play(); FailOncePlay = false; } if ((currentKeyboardState.IsKeyDown(Keys.Enter) && lastKeyboardState.IsKeyUp(Keys.Enter))) { KeyPress = soundBank.GetCue("KeyPress"); KeyPress.Play(); currentScreen = screen.Map1; } //reset all map data //reset map 1 Level1ArrowCount = 10; score = 0; timeforLevel1 = 70; for (int x = 0; x < 5; x++) Level1Baloons[x].doUpdate = true; //reset map 2 Level2ArrowCount = 13; score1 = 0; timeforLevel2 = 60; //Level2ArrowCount -= 1; //Level2ArrowCount += 2; for (int x = 0; x < 8; x++) Level2Baloons[x].doUpdate = true; //reset map 3 Level3ArrowCount = 15; score2 = 0; timeforLevel3 = 50; for (int x = 0; x < 10; x++) Level3Baloons[x].doUpdate = true; //reset map 4 Level4ArrowCount = 17; score3 = 0; timeforLevel4 = 40; for (int x = 0; x < 12; x++) Level4Baloons[x].doUpdate = true; //reset map 5 Level5ArrowCount = 20; score4 = 0; timeforLevel5 = 30; for (int x = 0; x < 15; x++) Level5Baloons[x].doUpdate = true; break; } case screen.Map1: { FailOncePlay = true; WinOncePlay = true; setCurrentScrren = 1; if ((currentKeyboardState.IsKeyDown(Keys.Escape) && lastKeyboardState.IsKeyUp(Keys.Escape))) { KeyPress = soundBank.GetCue("KeyPress"); KeyPress.Play(); currentScreen = screen.pause; } //if ((currentKeyboardState.IsKeyDown(Keys.F3) && lastKeyboardState.IsKeyUp(Keys.F3))) //{ // KeyPress = soundBank.GetCue("KeyPress"); // KeyPress.Play(); // currentScreen = screen.Mainmenu; //} map1Background.Update(); crosshair.UpdateCrosshair(); arrowLevel1.Update(); if ((currentKeyboardState.IsKeyDown(Keys.Space) && lastKeyboardState.IsKeyUp(Keys.Space)) && Level1ArrowCount >0) { Fire = soundBank.GetCue("Fire"); Fire.Play(); arrowLevel1.position = new Vector2(crosshair.position.X + 160, crosshair.position.Y) ; arrowLevel1.n = true; Level1ArrowCount--; } for (int x = 0; x < 5; x++) Level1Baloons[x].Update(gameTime); for(int x=0; x<5; x++) { if (arrowLevel1.rect.Intersects(Level1Baloons[x].rect) && Level1Baloons[x].doUpdate) { arrowLevel1.position = new Vector2(5000, 5000); Blast = soundBank.GetCue("Blast"); Blast.Play(); score += 10; Level1Baloons[x].doUpdate = false; } } //load next level if (Level1ArrowCount == 0 && arrowLevel1.position == new Vector2(5000, 5000) && score >= Level1DesiredScore) currentScreen = screen.NextLevel; //display fail screen if (Level1ArrowCount == 0 && arrowLevel1.position == new Vector2(5000, 5000) && score < Level1DesiredScore) currentScreen = screen.Fail; //load next level if (timeforLevel1 < 0 && score >= Level1DesiredScore) currentScreen = screen.NextLevel; if (!Level1Baloons[0].doUpdate && !Level1Baloons[1].doUpdate && !Level1Baloons[2].doUpdate && !Level1Baloons[3].doUpdate && !Level1Baloons[4].doUpdate) { if (score >= Level1DesiredScore) currentScreen = screen.NextLevel; else currentScreen = screen.Fail; } //display fail screen if(timeforLevel1 < 0 && score < Level1DesiredScore) currentScreen = screen.Fail; // checking time for map1 float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds; timer -= elapsed; if (timer < 0) { //Timer expired, execute action timeforLevel1--; timer = TIMER; //Reset Timer } break; } case screen.Map2: { FailOncePlay = true; WinOncePlay = true; setCurrentScrren = 2; if ((currentKeyboardState.IsKeyDown(Keys.Escape) && lastKeyboardState.IsKeyUp(Keys.Escape))) { KeyPress = soundBank.GetCue("KeyPress"); KeyPress.Play(); currentScreen = screen.pause; } // if ((currentKeyboardState.IsKeyDown(Keys.F3) && lastKeyboardState.IsKeyUp(Keys.F3))) //{ // KeyPress = soundBank.GetCue("KeyPress"); // KeyPress.Play(); // currentScreen = screen.Mainmenu; //} map2Background.Update(); crosshair.UpdateCrosshair(); arrowLevel2.Update(); if ((currentKeyboardState.IsKeyDown(Keys.Space) && lastKeyboardState.IsKeyUp(Keys.Space)) && Level2ArrowCount > 0) { Fire = soundBank.GetCue("Fire"); Fire.Play(); arrowLevel2.position = new Vector2(crosshair.position.X + 160, crosshair.position.Y); arrowLevel2.n = true; Level2ArrowCount--; } for (int x = 0; x < 8; x++) Level2Baloons[x].Update(gameTime); for (int x = 0; x < 8; x++) { if (arrowLevel2.rect.Intersects(Level2Baloons[x].rect) && Level2Baloons[x].doUpdate) { arrowLevel2.position = new Vector2(5000, 5000); Blast = soundBank.GetCue("Blast"); Blast.Play(); score1 += 10; Level2Baloons[x].doUpdate = false; } } //load next level if (Level2ArrowCount == 0 && arrowLevel2.position == new Vector2(5000, 5000) && score1 >= Level2DesiredScore) currentScreen = screen.NextLevel; //display fail screen if (Level2ArrowCount == 0 && arrowLevel2.position == new Vector2(5000, 5000) && score1 < Level2DesiredScore) currentScreen = screen.Fail; //load next level if (timeforLevel2 < 0 && score1 >= Level2DesiredScore) currentScreen = screen.NextLevel; if (!Level2Baloons[0].doUpdate && !Level2Baloons[1].doUpdate && !Level2Baloons[2].doUpdate && !Level2Baloons[3].doUpdate && !Level2Baloons[4].doUpdate && !Level2Baloons[5].doUpdate && !Level2Baloons[6].doUpdate && !Level2Baloons[7].doUpdate) { if (score1 >= Level2DesiredScore) currentScreen = screen.NextLevel; else currentScreen = screen.Fail; } //display fail screen if (timeforLevel2 < 0 && score1 < Level2DesiredScore) currentScreen = screen.Fail; // checking time for map1 float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds; timer1 -= elapsed; if (timer1 < 0) { //Timer expired, execute action timeforLevel2--; timer1 = TIMER1; //Reset Timer } //BOMBS //drop bomb at 55 if (timeforLevel2 < 55) { Level2Bombs[0].n = true; Level2Bombs[0].Update(gameTime); } //drop bomb at 35 if (timeforLevel2 < 35) { Level2Bombs[1].n = true; Level2Bombs[1].Update(gameTime); } //drop bomb at 15 if (timeforLevel2 < 15) { Level2Bombs[2].n = true; Level2Bombs[2].Update(gameTime); } //check bomb collide with bow for (int x = 0; x < 3; x++) { if (Level2Bombs[x].getRectangle().Intersects(crosshair.getRectangle())) { Bomb = soundBank.GetCue("Bomb"); Bomb.Play(); Level2Bombs[x].position = new Vector2(50000, 50000); Level2ArrowCount -= 1; } } //HEALTH //drop health at 45 if (timeforLevel2 < 45) { Level2Health[0].n = true; Level2Health[0].Update(gameTime); } //drop health at 25 if (timeforLevel2 < 25) { Level2Health[1].n = true; Level2Health[1].Update(gameTime); } //drop health at 10 if (timeforLevel2 < 10) { Level2Health[2].n = true; Level2Health[2].Update(gameTime); } //check health collide with arrow for (int x = 0; x < 3; x++) { if (Level2Health[x].getRectangle().Intersects(arrowLevel2.getRectangle())) { arrowLevel2.position = new Vector2(5000, 5000); Health = soundBank.GetCue("Health"); Health.Play(); Level2Health[x].position = new Vector2(50000, 50000); Level2ArrowCount += 2; } } break; } case screen.Map3: { FailOncePlay = true; WinOncePlay = true; setCurrentScrren = 3; if ((currentKeyboardState.IsKeyDown(Keys.Escape) && lastKeyboardState.IsKeyUp(Keys.Escape))) { KeyPress = soundBank.GetCue("KeyPress"); KeyPress.Play(); currentScreen = screen.pause; } // if ((currentKeyboardState.IsKeyDown(Keys.F3) && lastKeyboardState.IsKeyUp(Keys.F3))) //{ // KeyPress = soundBank.GetCue("KeyPress"); // KeyPress.Play(); // currentScreen = screen.Mainmenu; //} map3Background.Update(); crosshair.UpdateCrosshair(); arrowLevel3.Update(); if ((currentKeyboardState.IsKeyDown(Keys.Space) && lastKeyboardState.IsKeyUp(Keys.Space)) && Level3ArrowCount > 0) { Fire = soundBank.GetCue("Fire"); Fire.Play(); arrowLevel3.position = new Vector2(crosshair.position.X + 160, crosshair.position.Y); arrowLevel3.n = true; Level3ArrowCount--; } for (int x = 0; x < 10; x++) Level3Baloons[x].Update(gameTime); for (int x = 0; x < 10; x++) { if (arrowLevel3.rect.Intersects(Level3Baloons[x].rect) && Level3Baloons[x].doUpdate) { arrowLevel3.position = new Vector2(5000, 5000); Blast = soundBank.GetCue("Blast"); Blast.Play(); score2 += 10; Level3Baloons[x].doUpdate = false; } } //load next level if (Level3ArrowCount == 0 && arrowLevel3.position == new Vector2(5000, 5000) && score2 >= Level3DesiredScore) currentScreen = screen.NextLevel; //display fail screen if (Level3ArrowCount == 0 && arrowLevel3.position == new Vector2(5000, 5000) && score2 < Level3DesiredScore) currentScreen = screen.Fail; //load next level if (timeforLevel3 < 0 && score2 >= Level3DesiredScore) currentScreen = screen.NextLevel; if (!Level3Baloons[0].doUpdate && !Level3Baloons[1].doUpdate && !Level3Baloons[2].doUpdate && !Level3Baloons[3].doUpdate && !Level3Baloons[4].doUpdate && !Level3Baloons[5].doUpdate && !Level3Baloons[6].doUpdate && !Level3Baloons[7].doUpdate) { if (score2 >= Level3DesiredScore) currentScreen = screen.NextLevel; else currentScreen = screen.Fail; } //display fail screen if (timeforLevel3 < 0 && score2 < Level3DesiredScore) currentScreen = screen.Fail; // checking time for map1 float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds; timer2 -= elapsed; if (timer2 < 0) { //Timer expired, execute action timeforLevel3--; timer2 = TIMER2; //Reset Timer } //BOMBS //drop bomb at 45 if (timeforLevel3 < 45) { Level3Bombs[0].n = true; Level3Bombs[0].Update(gameTime); } //drop bomb at 35 if (timeforLevel3 < 35) { Level3Bombs[1].n = true; Level3Bombs[1].Update(gameTime); } //drop bomb at 25 if (timeforLevel3 < 25) { Level3Bombs[2].n = true; Level3Bombs[2].Update(gameTime); } //drop bomb at 15 if (timeforLevel3 < 15) { Level3Bombs[3].n = true; Level3Bombs[3].Update(gameTime); } //check bomb collide with bow for (int x = 0; x < 4; x++) { if (Level3Bombs[x].getRectangle().Intersects(crosshair.getRectangle())) { Bomb = soundBank.GetCue("Bomb"); Bomb.Play(); Level3Bombs[x].position = new Vector2(50000, 50000); Level3ArrowCount -= 1; } } //HEALTH //drop health at 40 if (timeforLevel3 < 40) { Level3Health[0].n = true; Level3Health[0].Update(gameTime); } //drop health at 30 if (timeforLevel3 < 30) { Level3Health[1].n = true; Level3Health[1].Update(gameTime); } //drop health at 20 if (timeforLevel3 < 20) { Level3Health[2].n = true; Level3Health[2].Update(gameTime); } //drop health at 10 if (timeforLevel3 < 10) { Level3Health[3].n = true; Level3Health[3].Update(gameTime); } //check health collide with arrow for (int x = 0; x < 4; x++) { if (Level3Health[x].getRectangle().Intersects(arrowLevel3.getRectangle())) { arrowLevel3.position = new Vector2(5000, 5000); Health = soundBank.GetCue("Health"); Health.Play(); Level3Health[x].position = new Vector2(50000, 50000); Level3ArrowCount += 2; } } break; } case screen.Map4: { FailOncePlay = true; WinOncePlay = true; setCurrentScrren = 4; if ((currentKeyboardState.IsKeyDown(Keys.Escape) && lastKeyboardState.IsKeyUp(Keys.Escape))) { KeyPress = soundBank.GetCue("KeyPress"); KeyPress.Play(); currentScreen = screen.pause; } //if ((currentKeyboardState.IsKeyDown(Keys.F3) && lastKeyboardState.IsKeyUp(Keys.F3))) //{ // KeyPress = soundBank.GetCue("KeyPress"); // KeyPress.Play(); // currentScreen = screen.Mainmenu; //} map4Background.Update(); crosshair.UpdateCrosshair(); arrowLevel4.Update(); if ((currentKeyboardState.IsKeyDown(Keys.Space) && lastKeyboardState.IsKeyUp(Keys.Space)) && Level4ArrowCount > 0) { Fire = soundBank.GetCue("Fire"); Fire.Play(); arrowLevel4.position = new Vector2(crosshair.position.X + 160, crosshair.position.Y); arrowLevel4.n = true; Level4ArrowCount--; } for (int x = 0; x < 12; x++) Level4Baloons[x].Update(gameTime); for (int x = 0; x < 3; x++) Level4DeathBaloons[x].Update(gameTime); for (int x = 0; x < 12; x++) { if (arrowLevel4.rect.Intersects(Level4Baloons[x].rect) && Level4Baloons[x].doUpdate) { arrowLevel4.position = new Vector2(5000, 5000); Blast = soundBank.GetCue("Blast"); Blast.Play(); score3 += 10; Level4Baloons[x].doUpdate = false; } //for death ballons if (x < 3) { if (arrowLevel4.rect.Intersects(Level4DeathBaloons[x].rect) && Level4DeathBaloons[x].doUpdate) { arrowLevel4.position = new Vector2(5000, 5000); Balloon = soundBank.GetCue("Balloon"); Balloon.Play(); //decrese score if hit score3 -= 20; Level4DeathBaloons[x].doUpdate = false; } } } //load next level if (Level4ArrowCount == 0 && arrowLevel4.position == new Vector2(5000, 5000) && score3 >= Level4DesiredScore) currentScreen = screen.NextLevel; //display fail screen if (Level4ArrowCount == 0 && arrowLevel4.position == new Vector2(5000, 5000) && score3 < Level4DesiredScore) currentScreen = screen.Fail; //load next level if (timeforLevel4 < 0 && score3 >= Level4DesiredScore) currentScreen = screen.NextLevel; if (!Level4Baloons[0].doUpdate && !Level4Baloons[1].doUpdate && !Level4Baloons[2].doUpdate && !Level4Baloons[3].doUpdate && !Level4Baloons[4].doUpdate && !Level4Baloons[5].doUpdate && !Level4Baloons[6].doUpdate && !Level4Baloons[7].doUpdate && !Level4Baloons[8].doUpdate && !Level4Baloons[9].doUpdate && !Level4Baloons[10].doUpdate && !Level4Baloons[11].doUpdate) { if (score3 >= Level4DesiredScore) currentScreen = screen.NextLevel; else currentScreen = screen.Fail; } //display fail screen if (timeforLevel4 < 0 && score3 < Level4DesiredScore) currentScreen = screen.Fail; // checking time for map1 float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds; timer3 -= elapsed; if (timer3< 0) { //Timer expired, execute action timeforLevel4--; timer3 = TIMER3; //Reset Timer } //BOMBS //drop bomb at 35 if (timeforLevel4 < 35) { Level4Bombs[0].n = true; Level4Bombs[0].Update(gameTime); } //drop bomb at 25 if (timeforLevel4 < 25) { Level4Bombs[1].n = true; Level4Bombs[1].Update(gameTime); } //drop bomb at 15 if (timeforLevel4 < 15) { Level3Bombs[2].n = true; Level3Bombs[2].Update(gameTime); } //drop bomb at 5 if (timeforLevel4 < 5) { Level4Bombs[3].n = true; Level4Bombs[3].Update(gameTime); } //check bomb collide with bow for (int x = 0; x < 4; x++) { if (Level4Bombs[x].getRectangle().Intersects(crosshair.getRectangle())) { Bomb = soundBank.GetCue("Bomb"); Bomb.Play(); Level4Bombs[x].position = new Vector2(50000, 50000); Level4ArrowCount -= 1; } } //HEALTH //drop health at 30 if (timeforLevel4 < 30) { Level4Health[0].n = true; Level4Health[0].Update(gameTime); } //drop health at 22 if (timeforLevel4 < 22) { Level4Health[1].n = true; Level4Health[1].Update(gameTime); } //drop health at 17 if (timeforLevel4 < 17) { Level4Health[2].n = true; Level4Health[2].Update(gameTime); } //drop health at 10 if (timeforLevel4 < 10) { Level4Health[3].n = true; Level4Health[3].Update(gameTime); } //drop health at 4 if (timeforLevel4 < 4) { Level4Health[4].n = true; Level4Health[4].Update(gameTime); } //check health collide with arrow for (int x = 0; x < 5; x++) { if (Level4Health[x].getRectangle().Intersects(arrowLevel4.getRectangle())) { arrowLevel4.position = new Vector2(5000, 5000); Health = soundBank.GetCue("Health"); Health.Play(); Level4Health[x].position = new Vector2(50000, 50000); Level4ArrowCount += 2; } } break; } case screen.Map5: { FailOncePlay = true; WinOncePlay = true; setCurrentScrren = 5; if ((currentKeyboardState.IsKeyDown(Keys.Escape) && lastKeyboardState.IsKeyUp(Keys.Escape))) { KeyPress = soundBank.GetCue("KeyPress"); KeyPress.Play(); currentScreen = screen.pause; } //if ((currentKeyboardState.IsKeyDown(Keys.F3) && lastKeyboardState.IsKeyUp(Keys.F3))) //{ // KeyPress = soundBank.GetCue("KeyPress"); // KeyPress.Play(); // currentScreen = screen.Mainmenu; //} map5Background.Update(); crosshair.UpdateCrosshair(); arrowLevel5.Update(); if ((currentKeyboardState.IsKeyDown(Keys.Space) && lastKeyboardState.IsKeyUp(Keys.Space)) && Level5ArrowCount > 0) { Fire = soundBank.GetCue("Fire"); Fire.Play(); arrowLevel5.position = new Vector2(crosshair.position.X + 160, crosshair.position.Y); arrowLevel5.n = true; Level5ArrowCount--; } for (int x = 0; x < 15; x++) Level5Baloons[x].Update(gameTime); for (int x = 0; x < 5; x++) Level5DeathBaloons[x].Update(gameTime); for (int x = 0; x < 15; x++) { if (arrowLevel5.rect.Intersects(Level5Baloons[x].rect) && Level5Baloons[x].doUpdate) { arrowLevel5.position = new Vector2(5000, 5000); Blast = soundBank.GetCue("Blast"); Blast.Play(); score4 += 10; Level5Baloons[x].doUpdate = false; } //for death ballons if (x < 5) { if (arrowLevel5.rect.Intersects(Level5DeathBaloons[x].rect) && Level5DeathBaloons[x].doUpdate) { arrowLevel5.position = new Vector2(5000, 5000); Balloon = soundBank.GetCue("Balloon"); Balloon.Play(); //decrese score if hit score4 -= 20; Level5DeathBaloons[x].doUpdate = false; } } } //load next level if (Level5ArrowCount == 0 && arrowLevel5.position == new Vector2(5000, 5000) && score4 >= Level5DesiredScore) currentScreen = screen.NextLevel; //display fail screen if (Level5ArrowCount == 0 && arrowLevel5.position == new Vector2(5000, 5000) && score4 < Level5DesiredScore) currentScreen = screen.Fail; //load next level if (timeforLevel5 < 0 && score4 >= Level5DesiredScore) currentScreen = screen.NextLevel; if (!Level5Baloons[0].doUpdate && !Level5Baloons[1].doUpdate && !Level5Baloons[2].doUpdate && !Level5Baloons[3].doUpdate && !Level5Baloons[4].doUpdate && !Level5Baloons[5].doUpdate && !Level5Baloons[6].doUpdate && !Level5Baloons[7].doUpdate && !Level5Baloons[8].doUpdate && !Level5Baloons[9].doUpdate && !Level5Baloons[10].doUpdate && !Level5Baloons[11].doUpdate && !Level5Baloons[12].doUpdate && !Level5Baloons[13].doUpdate && !Level5Baloons[14].doUpdate) { if (score4 >= Level5DesiredScore) currentScreen = screen.NextLevel; else currentScreen = screen.Fail; } //display fail screen if (timeforLevel5 < 0 && score4 < Level5DesiredScore) currentScreen = screen.Fail; // checking time for map1 float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds; timer4 -= elapsed; if (timer4 < 0) { //Timer expired, execute action timeforLevel5--; timer4 = TIMER4; //Reset Timer } //BOMBS //drop bomb at 27 if (timeforLevel5 < 27) { Level5Bombs[0].n = true; Level5Bombs[0].Update(gameTime); } //drop bomb at 22 if (timeforLevel5 < 22) { Level5Bombs[1].n = true; Level5Bombs[1].Update(gameTime); } //drop bomb at 17 if (timeforLevel5 < 17) { Level5Bombs[2].n = true; Level5Bombs[2].Update(gameTime); } //drop bomb at 12 if (timeforLevel5 < 12) { Level5Bombs[3].n = true; Level5Bombs[3].Update(gameTime); } //drop bomb at 7 if (timeforLevel5 < 7) { Level5Bombs[4].n = true; Level5Bombs[4].Update(gameTime); } //check bomb collide with bow for (int x = 0; x < 5; x++) { if (Level5Bombs[x].getRectangle().Intersects(crosshair.getRectangle())) { Bomb = soundBank.GetCue("Bomb"); Bomb.Play(); Level5Bombs[x].position = new Vector2(50000, 50000); Level5ArrowCount -= 1; } } //HEALTH //drop health at 25 if (timeforLevel5 < 25) { Level5Health[0].n = true; Level5Health[0].Update(gameTime); } //drop health at 20 if (timeforLevel5 < 20) { Level5Health[1].n = true; Level5Health[1].Update(gameTime); } //drop health at 15 if (timeforLevel5 < 15) { Level5Health[2].n = true; Level5Health[2].Update(gameTime); } //drop health at 10 if (timeforLevel5 < 10) { Level5Health[3].n = true; Level5Health[3].Update(gameTime); } //drop health at 4 if (timeforLevel5 < 4) { Level5Health[4].n = true; Level5Health[4].Update(gameTime); } //check health collide with arrow for (int x = 0; x < 5; x++) { if (Level5Health[x].getRectangle().Intersects(arrowLevel5.getRectangle())) { arrowLevel5.position = new Vector2(5000, 5000); Health = soundBank.GetCue("Health"); Health.Play(); Level5Health[x].position = new Vector2(50000, 50000); Level5ArrowCount += 2; } } break; } case screen.NextLevel: { if (WinOncePlay) { Win = soundBank.GetCue("Win"); Win.Play(); WinOncePlay = false; } if ((currentKeyboardState.IsKeyDown(Keys.Enter) && lastKeyboardState.IsKeyUp(Keys.Enter)) && setCurrentScrren != 5) { if (setCurrentScrren == 1) currentScreen = screen.Map2; if (setCurrentScrren == 2) currentScreen = screen.Map3; if (setCurrentScrren == 3) currentScreen = screen.Map4; if (setCurrentScrren== 4) currentScreen = screen.Map5; } if (setCurrentScrren == 5) currentScreen = screen.Win; break; } case screen.pause: { pauseBackground.Update(); if ((currentKeyboardState.IsKeyDown(Keys.Enter) && lastKeyboardState.IsKeyUp(Keys.Enter))) { if (setCurrentScrren == 1) currentScreen = screen.Map1; if (setCurrentScrren == 2) currentScreen = screen.Map2; if (setCurrentScrren == 3) currentScreen = screen.Map3; if (setCurrentScrren == 4) currentScreen = screen.Map4; if (setCurrentScrren == 5) currentScreen = screen.Map5; } if ((currentKeyboardState.IsKeyDown(Keys.F3) && lastKeyboardState.IsKeyUp(Keys.F3))) { currentScreen = screen.Mainmenu; } break; } default: { break; } } base.Update(gameTime); }