/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { using (Game1 game = Game1.GetGame()) { game.Run(); } }
public void MouseClicked(int x, int y, ref GameType gameType) { mouseClick = new Rectangle(x, y, 10, 10); if (mouseClick.Intersects(Bouton_Exit)) { Game1.GetGame().Exit(); } else if (mouseClick.Intersects(Bouton_Options)) { gameType = GameType.Menu_Option_Type; } else if (mouseClick.Intersects(Bouton_Multi)) { gameType = GameType.Menu_Play_Multi_Type; } else if (mouseClick.Intersects(Bouton_Play)) { gameType = GameType.Menu_Play_Type; } else if (mouseClick.Intersects(Bouton_World1)) { gameType = GameType.Menu_Play_Solo_World1_Type; } else if (mouseClick.Intersects(Bouton_World2)) { gameType = GameType.Menu_Play_Solo_World2_Type; } else if (mouseClick.Intersects(Bouton_Solo)) { gameType = GameType.Menu_Play_Solo_Type; } }
void MouseClicked(int x, int y, ref GameType gametype) { mouseClick = new Rectangle(x, y, 10, 10); if (mouseClick.Intersects(Bouton_Play)) { gametype = GameType.Menu_Play_Type; } else if (mouseClick.Intersects(Bouton_Exit)) { Game1.GetGame().Exit(); } else if (mouseClick.Intersects(Bouton_Res)) { gametype = GameType.Menu_Option_Type; } else if (mouseClick.Intersects(Bouton_Full)) { Game1.GetGame().IsFullScreen = !Game1.GetGame().IsFullScreen; } else if (mouseClick.Intersects(Bouton_Sound)) { SoundEffect.MasterVolume = 1.0f - SoundEffect.MasterVolume; MediaPlayer.Volume = 1.0f - MediaPlayer.Volume; } }
public ScreenManager(GameType gametype, Game1 game) { menubase = new Menu_Base(Content_Manager.getInstance().Textures["menubase"]); menuoptions = new Menu_Options(Content_Manager.getInstance().Textures["menuoptions"]); menuplay = new Menu_Play(Content_Manager.getInstance().Textures["menuplay"]); menuSolo = new Menu_Play_Solo(Content_Manager.getInstance().Textures["menusolo"]); menusolo1 = new Menu_Play_Solo_World1(Content_Manager.getInstance().Textures["solo1"]); menusolo2 = new Menu_Play_Solo_World2(Content_Manager.getInstance().Textures["solo2"]); menuMulti = new Menu_Play_Multi(Content_Manager.getInstance().Textures["menumulti"]); menupauseoption = new Menu_Pause_Options(Content_Manager.getInstance().Textures["menupauseoption"]); casper = new Casper(Content_Manager.getInstance().Textures["Casper"], new Rectangle(0, 0, 16, 34)); player2 = new Casper(Content_Manager.getInstance().Textures["Casper"], new Rectangle(50, 50, 16, 34)); casper2 = new Casper(Content_Manager.getInstance().Textures["Player1"], new Rectangle(50, 50, 0, 0)); controls = new Controls(casper.Position, casper.Velocity, casper.Speed, Keys.W, Keys.A, Keys.D, Keys.S); controlsPlayer2 = new Controls(player2.Position, player2.Velocity, player2.Speed, Keys.Up, Keys.Left, Keys.Right, Keys.Down); controlsWorld2 = new Controls(casper2.Position, casper2.Velocity, casper2.Speed, Keys.Up, Keys.Left, Keys.Right, Keys.Down); world2vert1 = new Decors(Content_Manager.getInstance().Textures["vert"], new Rectangle(-1680, 0, 1680, 1050)); world2vert2 = new Decors(Content_Manager.getInstance().Textures["vert"], new Rectangle(1680, 0, 1680, 1050)); camera = new Camera(Game1.GetGame().GraphicsDevice.Viewport); game.casperr = casper; decors = new Decors(Content_Manager.getInstance().Textures["Level1"], new Rectangle(0, 0, 1680, 1050)); decors1 = new Decors(Content_Manager.getInstance().Textures["Level1"], new Rectangle(1680, 0, 1680, 1050)); decors2 = new Decors(Content_Manager.getInstance().Textures["Level1"], new Rectangle(-1680, 0, 1680, 1050)); world2 = new Decors(Content_Manager.getInstance().Textures["world2"], new Rectangle(0, 0, 1680, 1050)); menupause = new Menu_Pause(Content_Manager.getInstance().Textures["menupause"]); level1 = new Level1(new Vector2(0, 0)); obstacles = new Obstacles(level1.getList()); previousgametype = GameType.Exit; this.gametype = gametype; }
public Casper(Texture2D casper, Rectangle hitbox) : base(2, casper, hitbox) { this.casper = casper; this.Position = new Vector2(840, 250); this.Velocity = new Vector2(0, 0); this.Speed = 0.01f; camera = new Camera(Game1.GetGame().GraphicsDevice.Viewport); animation = new Animation(); }
void MouseClicked(int x, int y, ref GameType gametype) { mouseClick = new Rectangle(x, y, 10, 10); if (mouseClick.Intersects(Bouton_Play)) { gametype = GameType.Menu_Play_Type; } else if (mouseClick.Intersects(Bouton_Exit)) { Game1.GetGame().Exit(); } else if (mouseClick.Intersects(Bouton_Options)) { gametype = GameType.Menu_Option_Type; } }
void MouseClicked(int x, int y, ref GameType gametype, GameType previousgametype) { mouseClick = new Rectangle(x, y, 10, 10); if (mouseClick.Intersects(Bouton_Resume)) { gametype = previousgametype; MediaPlayer.Stop(); MediaPlayer.Play(SoundManager.ingame); } else if (mouseClick.Intersects(Bouton_Exit)) { Game1.GetGame().Exit(); } else if (mouseClick.Intersects(Bouton_Main)) { MediaPlayer.Play(SoundManager.menu); gametype = GameType.Menu_Base_Type; } else if (mouseClick.Intersects(Bouton_Options)) { gametype = GameType.Menu_Pause_Option; } }
void MouseClicked(int x, int y, ref GameType gameType) { mouseClick = new Rectangle(x, y, 10, 10); if (mouseClick.Intersects(Bouton_Exit)) { Game1.GetGame().Exit(); } else if (mouseClick.Intersects(Bouton_Options)) { gameType = GameType.Menu_Option_Type; } else if (mouseClick.Intersects(Bouton_Solo)) { gameType = GameType.Menu_Play_Solo_Type; } else if (mouseClick.Intersects(Bouton_Multi)) { gameType = GameType.Menu_Play_Multi_Type; MediaPlayer.Stop(); MediaPlayer.Play(SoundManager.ingame); MediaPlayer.IsRepeating = true; } }
public void update(GameTime gametime) { camera.update(gametime, new Vector2(840, 0)); keyboardstate = Keyboard.GetState(); switch (gametype) { case GameType.Menu_Base_Type: menubase.update(gametime, ref gametype, ref previousgametype); previousgametype = GameType.Exit; break; case GameType.Menu_Play_Type: menuplay.update(gametime, ref gametype, ref previousgametype); previousgametype = GameType.Menu_Base_Type; break; case GameType.Menu_Play_Solo_Type: menuSolo.update(gametime, ref gametype, ref previousgametype); previousgametype = GameType.Menu_Play_Type; break; case GameType.Menu_Play_Solo_World1_Type: menusolo1.update(gametime, ref gametype, ref previousgametype); previousgametype = GameType.Menu_Play_Solo_Type; break; case GameType.Menu_Play_Solo_World2_Type: menusolo2.update(gametime, ref gametype, ref previousgametype); previousgametype = GameType.Menu_Play_Solo_Type; break; case GameType.Menu_Play_Multi_Type: // menuMulti.update(gametime, ref gametype, ref previousgametype); camera.update(gametime, casper.Position); casper.update(gametime, controls, gametype, level1); player2.update(gametime, controlsPlayer2, gametype, level1); Game1.GetGame().IsMouseVisible = false; if (keyboardstate.IsKeyDown(Keys.Escape) && previouskeyboardstate.IsKeyUp(Keys.Escape)) { previousgametype = GameType.Menu_Play_Multi_Type; casper.update(gametime, controls, gametype, level1); player2.update(gametime, controlsPlayer2, gametype, level1); Game1.GetGame().IsMouseVisible = true; MediaPlayer.Stop(); MediaPlayer.Play(SoundManager.pause); gametype = GameType.Menu_Pause; } previouskeyboardstate = keyboardstate; break; case GameType.Menu_Option_Type: menuoptions.update(gametime, ref gametype, ref previousgametype); previousgametype = GameType.Menu_Base_Type; break; case GameType.Menu_Play_Solo_world1_lvl1: camera.update(gametime, casper.Position); casper.update(gametime, controls, gametype, level1); Game1.GetGame().IsMouseVisible = false; if (keyboardstate.IsKeyDown(Keys.Escape) && previouskeyboardstate.IsKeyUp(Keys.Escape)) { //casper.update(gametime); Game1.GetGame().IsMouseVisible = true; MediaPlayer.Stop(); MediaPlayer.Play(SoundManager.pause); gametype = GameType.Menu_Pause; previousgametype = GameType.Menu_Play_Solo_world1_lvl1; } previouskeyboardstate = keyboardstate; break; case GameType.Menu_Play_Solo_world2_lvl1: camera.update(gametime, casper2.Position); casper2.update(gametime, controlsPlayer2, gametype, level1); Game1.GetGame().IsMouseVisible = false; if (keyboardstate.IsKeyDown(Keys.Escape) && previouskeyboardstate.IsKeyUp(Keys.Escape)) { //casper.update(gametime); Game1.GetGame().IsMouseVisible = true; MediaPlayer.Stop(); MediaPlayer.Play(SoundManager.pause); gametype = GameType.Menu_Pause; previousgametype = GameType.Menu_Play_Solo_world2_lvl1; } previouskeyboardstate = keyboardstate; break; case GameType.Exit: Game1.GetGame().Exit(); break; case GameType.Menu_Pause: camera.update(gametime, casper.Position); if (keyboardstate.IsKeyDown(Keys.Escape) && previouskeyboardstate.IsKeyUp(Keys.Escape)) { Game1.GetGame().IsMouseVisible = false; gametype = previousgametype; MediaPlayer.Stop(); MediaPlayer.Play(SoundManager.ingame); } menupause.update(gametime, ref gametype, ref previousgametype, camera.centre); previouskeyboardstate = keyboardstate; break; case GameType.Menu_Pause_Option: camera.update(gametime, casper.Position); menupauseoption.update(gametime, ref gametype, ref previousgametype, camera.centre); break; default: menubase.update(gametime, ref gametype, ref previousgametype); break; } }