public static void adder(Game1 game,Game1.gameState _currentState,int width,int height) { if (_currentState == Game1.gameState.MainMenuState) { game.Components.Clear(); var settingsBlueFire = new ParticleSettings(300, new Color(100, 147, 237, 255), new Color(0, 1f, 1f, 0f), 200, 30, 1, (v, t) => Vector2.UnitY * -5 + Vector2.UnitX * 2, pos => pos + ParticleHelper.GetRandomVector() * 10, 2, 0.4f); var BlueFire = new ParticlesMgr(game, settingsBlueFire) { Pos = new Vector2((float)width*0.5f, (float)height*0.45f) }; game.Components.Add(BlueFire); } if ((_currentState == Game1.gameState.Level2)||_currentState==Game1.gameState.Checkpause) { game.Components.Clear(); for (int i = 0; i < 40; i++) { var settingsNeige = new ParticleSettings(2500 + i * 300, new Color(255, 255, 255), new Color(255, 255, 255), 10, 1000, 1, (v, t) => Vector2.UnitY * 10 + Vector2.UnitX * ParticleHelper.GetRandomFloat(-10, 10), pos => pos + ParticleHelper.GetRandomVector(),0.3f,0.3f); var Neige = new ParticlesMgr(game, settingsNeige) { Pos = new Vector2(ParticleHelper.GetRandomFloat(0, 1500), i * -100) }; game.Components.Add(Neige); } } if (_currentState == Game1.gameState.SEU||_currentState==Game1.gameState.Editeur_mapVV||_currentState==Game1.gameState.Pause||_currentState==Game1.gameState.level_Pselect ) { game.Components.Clear(); } }
protected void pause(Game1 game, KeyboardState keybord, Game1.gameState _currentState) { if (keybord.IsKeyDown(Keys.P) || keybord.IsKeyDown(Keys.Escape)) { game.ChangeState(Game1.gameState.Pause, _currentState); } }
public GameWin(Game1 game1, GraphicsDeviceManager graphics, ContentManager Content) { rectangle = new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight); game1.IsMouseVisible = true; MediaPlayer.Volume = vol; songMenu = Content.Load<Song>("Menu//songMenu"); }
public override void Update(Game1 game, Audio audio) { KeyboardState keyboard = Keyboard.GetState(); MouseState mouse = Mouse.GetState(); rect = new Rectangle(mouse.X, mouse.Y, 1, 1); button.Update(ref keyboard, ref old, ref mouse, ref rect, ref game, ref tab, ""); old = keyboard; }
public Editeur_MapVV(Game1 game1, GraphicsDeviceManager graphics, ContentManager Content) { game1.IsMouseVisible = false; oldkey = Keyboard.GetState(); collision = new Collision(); _pause = new _Pause(game1, graphics, Content); }
public ParticlesMgr(Game1 game, ParticleSettings settings) : base(game) { _game = game; _settings = settings; _particles = new List<Particle>(); for (int i = 0; i < _settings.Max; i++) _particles.Add(new Particle(this)); }
public static void adder_in_pause(Game1 game) { game.Components.Clear(); var settingsBlueFire = new ParticleSettings(300, new Color(100, 147, 237, 255), new Color(0, 1f, 1f, 0f), 200, 30, 1, (v, t) => Vector2.UnitY * -5 + Vector2.UnitX * 2, pos => pos + ParticleHelper.GetRandomVector() * 10, 2, 0.4f); var BlueFire = new ParticlesMgr(game, settingsBlueFire) { Pos = new Vector2(640, 355) }; game.Components.Add(BlueFire); }
public leveleditor(Game1 game1, GraphicsDeviceManager graphics, ContentManager Content) { game1.IsMouseVisible = false; oldkey = Keyboard.GetState(); collision = new Collision(); _pause = new _Pause(game1, graphics, Content); save = new Sauveguarde(); path = game1.path; }
public override void Update(Game1 game, Audio audio) { timer--; if (timer <= 0) game.ChangeState(Game1.gameState.MainMenuState); /* KeyboardState keyboard = Keyboard.GetState(); MouseState mouse = Mouse.GetState(); listbox.Update(ref keyboard, ref mouse);*/ }
public Initialisateur(Game1 game1, GraphicsDeviceManager graphics, ContentManager Content) { taille_logo = Math.Min(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight); rectangle = new Rectangle(graphics.PreferredBackBufferWidth/2-taille_logo/2,graphics.PreferredBackBufferHeight/2-taille_logo/2 , taille_logo ,taille_logo ); game1.IsMouseVisible = false; timer = 10;//550; // listbox = new Listbox("SEU", 100, 100, 500, 500); }
/// <summary> /// The main entry point for the application. /// </summary> /// static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); using (Game1 game = new Game1()) { game.Run(); } }
public _Pause(Game1 game1, GraphicsDeviceManager graphics, ContentManager Content) { rectangle = new Rectangle(0, 0, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight); game1.IsMouseVisible = true; MediaPlayer.Volume = vol; songMenu = Content.Load<Song>("Menu//songMenu"); button = new Button(1, 4, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight, 0.07f, 0.1f, 0); button.activate(0, 0, 0.1f, 0.1f, "Resume", LocalizedString.Resume ); tab = 0; }
public override void Update(Game1 game, Audio audio) { KeyboardState keyboard = Keyboard.GetState(); MouseState mouse = Mouse.GetState(); if (keyboard.IsKeyUp(Microsoft.Xna.Framework.Input.Keys.Escape) && oldkey.IsKeyDown(Keys.Escape)) { _pause.checkpause(keyboard, ref _checkpause); } if (!_checkpause) { // ici le code de jeu update } else { game.ChangeState2(Game1.gameState.Checkpause); MediaPlayer.Stop(); ParticleAdder.adder(game, Game1.gameState.Checkpause, height, width); _pause.Update(game, audio, ref _checkpause); } oldkey = keyboard; }
public Shoot_Em_Up(Game1 game1, GraphicsDeviceManager graphics, ContentManager Content) { game1.IsMouseVisible = false; _pause = new _Pause(game1, graphics, Content); }
public void update(ref IA_manager_T manage_T, ref IA_manager_V manage_V, ref IA_manager_K manage_k, ref KeyboardState keybord, Game1 game, ref Scrolling_ManagerV scrollM, ref Ovni ovni) { manage_T = this.manage_T; manage_V = this.manage_V; manage_k = this.manage_k; scrollM = this.scrollingM; ovni = this.ovni; this.game = game; if (keybord.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Up)) ++seconde; if (keybord.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Down)) --seconde; }
protected void fail(Game1 game, sprite_broillon sprite, Game1.gameState _currentState) { if (sprite.rectangle.Bottom > 2 * height||sprite.dead ) game.ChangeState(Game1.gameState.Pause, _currentState); }
public Leveleditorselect(Game1 game1, GraphicsDeviceManager graphics, ContentManager Content) { game1.IsMouseVisible = true; }
public override void Update(Game1 game, Audio audio) { KeyboardState keyboard = Keyboard.GetState(); MouseState mouse = Mouse.GetState(); Rectangle mouse_rec = new Rectangle(mouse.X, mouse.Y, 1, 1); if (keyboard.IsKeyUp (Keys.Tab) && oldkey.IsKeyDown(Keys.Tab)) { tab = (tab + 1) % 3; } if (list1.in_use) { selected_item = list1.selectedItem; } else if (list2.in_use) { selected_item = list2.selectedItem; } butts.Update(ref keyboard,ref oldkey , ref mouse, ref mouse_rec, ref game, ref tab,selected_item ); list1.Update(ref keyboard,ref oldkey , ref mouse,ref mouse_rec ,ref tab); list2.Update(ref keyboard,ref oldkey, ref mouse,ref mouse_rec ,ref tab); oldkey = keyboard; }
public PlayingState(Game1 game1, GraphicsDeviceManager graphics, ContentManager content) { _pause = new _Pause(game1, graphics, Content); }
public void Update(ref KeyboardState Key, ref KeyboardState old, ref MouseState mouse, ref Rectangle mouse_rec, ref Game1 game, ref int tab, string name1, ref bool pause) { if (tab == this.tab) { intecep = false; for (int i = 0; i < rect.GetLength(0); ++i) for (int j = 0; j < rect.GetLength(1); ++j) { if (mouse_rec.Intersects(rect[i, j])) { X = i; Y = j; intecep = true; } } if (old.IsKeyDown(Keys.Up) && Key.IsKeyUp(Keys.Up)) { Y = (Y - 1) % rect.GetLength(1); if (gameState[X, Y] == null) Y = (Y - 1) % rect.GetLength(1); } else if (old.IsKeyDown(Keys.Down) && Key.IsKeyUp(Keys.Down)) { Y = (Y + 1) % rect.GetLength(1); if (gameState[X, Y] == null) Y = (Y + 1) % rect.GetLength(1); } else if (old.IsKeyDown(Keys.Right) && Key.IsKeyUp(Keys.Right)) { X = (X + 1) % rect.GetLength(0); if (gameState[X, Y] == null) X = (X + 1) % rect.GetLength(0); } else if (old.IsKeyDown(Keys.Left) && Key.IsKeyUp(Keys.Left)) { X = (X - 1) % rect.GetLength(0); if (gameState[X, Y] == null) X = (X - 1) % rect.GetLength(0); } select = new Vector2(rect[X, Y].X - selection.Width, rect[X, Y].Y); if ((intecep && mouse.LeftButton == ButtonState.Pressed) || Key.IsKeyDown(Keys.Enter)) { if (gameState[X, Y] == "SEU") { game.level = levelname[X, Y]; game.ChangeState(Game1.gameState.SEU); } else if (gameState[X, Y] == "Checkpause") game.ChangeState(Game1.gameState.Checkpause); else if (gameState[X, Y] == "EditSEU") { game.level = "edit"; game.ChangeState(Game1.gameState.Editeur_mapVV); } else if (gameState[X, Y] == "Init") game.ChangeState(Game1.gameState.Initialisateur); else if (gameState[X, Y] == "LevelSelect") game.ChangeState(Game1.gameState.Level_select_state); else if (gameState[X, Y] == "Level2") { game.level = levelname[X, Y]; game.ChangeState(Game1.gameState.Level2); } else if (gameState[X, Y] == "Main") game.ChangeState(Game1.gameState.MainMenuState); else if (gameState[X, Y] == "Null") game.ChangeState(Game1.gameState.Null); else if (gameState[X, Y] == "Option") game.ChangeState(Game1.gameState.OptionsState); else if (gameState[X, Y] == "Pause") game.ChangeState(Game1.gameState.Pause); else if (gameState[X, Y] == "Play") game.ChangeState(Game1.gameState.PlayingState); else if (gameState[X, Y] == "LevelEdit") { if (name1 != string.Empty) game.level = name1; else game.level = name[X, Y]; if (game.level != "LevelEdit") game.ChangeState(Game1.gameState.leveleditor); } else if (gameState[X, Y] == "LevelSelect_P") game.ChangeState(Game1.gameState.level_Pselect); else if (gameState[X, Y] == "Exit") game.Exit(); else if (gameState[X, Y] == "Last") game.GetPreviousState(); else if (gameState[X, Y] == "Resume") game.ChangeState2(Game1.gameState.Null); else if (gameState[X, Y] == "Next") game.nextgame(); else if (gameState[X, Y] == "Replay") game.replay(); else game.ChangeState(Game1.gameState.MainMenuState); pause = false; System.Threading.Thread.Sleep(G_latence); } } }
public void Update(KeyboardState keyboard, Game1 game, KeyboardState oldkey) { if (automatic_controlled)//movement automatic de fin de jeu up(); else// controlle du vaisseau { if (keyboard.IsKeyUp(Keys.T) && oldkey.IsKeyDown(Keys.T)) type += 3; else if (type < 3) { if ((keyboard.IsKeyUp(Keys.Up) && keyboard.IsKeyUp(Keys.Down) && keyboard.IsKeyUp(Keys.Right) && keyboard.IsKeyUp(Keys.Left)) || keyboard.IsKeyDown(Keys.Left) && keyboard.IsKeyDown(Keys.Right)) move(); else { if (keyboard.IsKeyDown(Keys.Up) && (rectangle_C.Y > 0)) up(); if (keyboard.IsKeyDown(Keys.Down) && (rectangle_C.Bottom < height)) down(); if (keyboard.IsKeyDown(Keys.Right) && (rectangle_C.X + rectangle_C.Width < width)) right(); if (keyboard.IsKeyDown(Keys.Left) && (rectangle_C.X > 0)) left(); } } else { type %= 5; Transform(); } } change_T += 1;// timer pour l animation if (keyboard.IsKeyDown(Keys.D1) || keyboard.IsKeyDown(Keys.F1)) power = 1; if (keyboard.IsKeyDown(Keys.D2) || keyboard.IsKeyDown(Keys.F2)) power = 2; if (keyboard.IsKeyDown(Keys.D3) || keyboard.IsKeyDown(Keys.F3)) power = 3; if (keyboard.IsKeyDown(Keys.D4) || keyboard.IsKeyDown(Keys.F4)) power = 4; if (vie <= 0) game.ChangeState(Game1.gameState.Pause); bullet.Bullet_Update(keyboard, this, oldkey, new Vector2(0, 1), power, ref bulletL, ref sizeX, ref sizeY, ref timer); Update_rec_collision(); }
public abstract void Update(Game1 game, Audio audio);
public override void Update(Game1 game, Audio audio) { KeyboardState keyboard; keyboard = Keyboard.GetState(); if (keyboard.IsKeyDown(Keys.Escape) && latence <= 0) { _pause.checkpause(keyboard, ref _checkpause); latence = 30; } if (latence > 0) --latence; if (!_checkpause) { game.ChangeState2(Game1.gameState.Null); // scrolling scrolling1.Update(keyboard); // collision Allen if (collision.Collision_sp_sol(ref allen, ref platform_M)) { allen.marche(); allen.jump_off = true; allen.chute = false; } else { allen.air(); } allen.update(keyboard); //collision ia collision.collision_ia_sol(manageS, ref platform_M); manageS.Update(allen, ref keyboard); collision.collision_ia_AR_sol(managerAR, ref platform_M); managerAA.Update(ref keyboard); collision.collision_ia_sol(managerAA, ref platform_M); collision.coll_AL_IA(manageS, ref allen); collision.coll_AL_IA(managerAA , ref allen); collision.coll_AL_IA(managerAR, ref allen); //manager IA managerAR.Update(ref keyboard); //manager platform platform_M.Update(keyboard); } else { game.ChangeState2(Game1.gameState.Checkpause); MediaPlayer.Stop(); ParticleAdder.adder(game, Game1.gameState.Checkpause,height,width); _pause.Update(game, audio, ref _checkpause); } //partie perdu fail(game, allen, Game1.gameState.SEU); //audio if (allen.rectangle.Right >= width * 2 - 50) game.ChangeState(Game1.gameState.Pause, Game1.gameState.win ); }
public override void Update(Game1 game, Audio audio) { KeyboardState keyboard; keyboard = Keyboard.GetState(); if (keyboard.IsKeyDown(Keys.Escape) && latence <= 0) { _pause.checkpause(keyboard, ref _checkpause); latence = 30; } if (latence > 0) --latence; if (!_checkpause) { game.ChangeState2(Game1.gameState.Null); // scrolling verticale // scrolling1.Update(); // scrolling2.Update(); Scroll.Update(); //vaisseau vaisseau.Update(keyboard, game, oldkey); //update ia jbdcvf // aster.update(); ovini.Update(ref game_time) ; manage_T.Update(ref game, ref game_time); manage_V.Update(ref vaisseau, ref game_time); manage_k.Update(ref vaisseau, ref game_time); collision.hero_missile(manage_T, ref vaisseau); collision.hero_missile(manage_V, ref vaisseau); collision.col_H_IA(manage_k, ref vaisseau); collision.col_H_IA(manage_V, ref vaisseau); collision.col_H_IA(manage_T, ref vaisseau); // collision.Ovni_vaiss(ref ovini, ref vaisseau); //update collision collision.collision_ai_missile(ref vaisseau, manage_k); collision.collision_ai_missile(ref vaisseau, manage_V); collision.collision_ai_missile(ref vaisseau, manage_T); } else { game.ChangeState2(Game1.gameState.Checkpause); _pause.Update(game, audio, ref _checkpause); } // update fin de jeu if (manage_k.Ia_manage.Count == 0 && manage_T.Ia_manage.Count == 0 && manage_V.Ia_manage.Count == 0) { if (timer == -100) { vaisseau.gagne(); timer = vaisseau.rectangle.Y / 2; // aster.visible = false; manage_k.bulletL.Clear(); manage_T.bulletL.Clear(); manage_V.bulletL.Clear(); } if (timer < 0 && timer != -100) game.ChangeState(Game1.gameState.level_Pselect );//va au level2 timer--; } //update interface oldkey = keyboard; game_time++; }
public void Update(Game1 game, Audio audio, ref bool checkpause) { KeyboardState keyboard = Keyboard.GetState(); MouseState mouse = Mouse.GetState(); mouserec = new Rectangle(mouse.X, mouse.Y, 1, 1); button.Update(ref keyboard, ref old, ref mouse, ref mouserec, ref game, ref tab, "", ref checkpause); old = keyboard; }
public override void Update(Game1 game, Audio audio) { KeyboardState keyboard; MouseState mouse; mouse = Mouse.GetState(); keyboard = Keyboard.GetState(); if (keyboard.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Escape) && latence <= 0) { _pause.checkpause(keyboard, ref _checkpause); latence = 30; user.Hide(); } if (latence > 0) --latence; if (!_checkpause) { if (mouse.LeftButton == Microsoft.Xna.Framework.Input.ButtonState.Pressed && !user.IHave_control) { spawn = existcheck(ref iaType, mouse); user._show(mouse.X, mouse.Y, iaType, spawn); } if (user.IHave_control) user.TopMost = true; else { user.update(ref manage_T, ref manage_V, ref manage_k, ref keyboard, game, ref Scroll_manager, ref ovni); // scrolling1.update_ophelia(keyboard); Scroll_manager.Update_ophelia(keyboard); } manage_k.Update_ophelia(keyboard); manage_T.Update_ophelia(keyboard); manage_V.Update_ophelia(keyboard); ovni.Update(keyboard); } else { game.ChangeState2(Game1.gameState.Checkpause); MediaPlayer.Stop(); ParticleAdder.adder(game, Game1.gameState.Checkpause, height, width); _pause.Update(game, audio, ref _checkpause); } //update interface oldkey = keyboard; }
public override void Update(Game1 game, Audio audio) { }
public void Update(ref Game1 game, ref int gametime) { for (int i = 0; i < ia_manage.Count; ++i) { if (gametime >=ia_manage[i]. timer_lunch) { ia_manage[i].bullet.Bullet_Update2(ia_manage[i], new Vector2(0, -1), 1, ref bulletL); moveH(ref i); ia_manage[i].Update_rec_collision(); } this.ia_manage[i].Timer++; if (this.ia_manage[i].Timer == this.AnimationSpeed) { this.ia_manage[i].Timer = 0; this.ia_manage[i].FrameColunm ++; if (ia_manage[i].FrameColunm >= 1 && ia_manage[i].FrameColunm < 13) { ia_manage[i]. Effects = SpriteEffects.None; } if (ia_manage[i]. FrameColunm > 12 &&ia_manage[i]. FrameColunm < 25) { ia_manage[i]. Effects = SpriteEffects.FlipHorizontally; ia_manage[i]. FrameColunm = 1; } if (ia_manage[i]. FrameColunm > 24) { ia_manage[i]. FrameColunm = 1; ia_manage[i]. Effects = SpriteEffects.None; } remove(ref i); } } //update che chaque missile for (int i = 0; i < bulletL.Count; i++) { bulletL[i].update2(); if (bulletL[i].rectangle_C.Top > 1080) bulletL.RemoveAt(i); } }