示例#1
0
        public Game1()
        {
            //display
            displaymode = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode;
            graphics = new GraphicsDeviceManager(this);
            height =  displaymode.Height;
            width = displaymode.Width;
            graphics.PreferredBackBufferHeight = height;
            graphics.PreferredBackBufferWidth = width;
            graphics.ApplyChanges();
            graphics.IsFullScreen = fullScreen ;

            //Content
            Content.RootDirectory = "Content";
            audio = new Audio(Content);
            //state
            _currentState = gameState.Initialisateur;
            StateManager = new Dictionary<gameState, GameState>();
            StateManager.Add(gameState.PlayingState, new PlayingState(this,graphics,Content));
            StateManager.Add(gameState.MainMenuState, new MainMenuState(this, graphics, Content));
            StateManager.Add(gameState.Level_select_state, new Level_select_state(this, graphics, Content));
            StateManager.Add(gameState.Level2, new Level2(this, graphics, Content));
            StateManager.Add(gameState.SEU, new Shoot_Em_Up(this, graphics, Content));
            StateManager.Add(gameState.Pause, new Pause(this, graphics, Content));
            StateManager.Add(gameState.Initialisateur, new Initialisateur(this, graphics, Content));
            StateManager.Add(gameState.Editeur_mapVV, new Editeur_MapVV(this, graphics, Content));
            StateManager.Add(gameState.leveleditor, new leveleditor(this, graphics, Content));
            StateManager.Add(gameState.level_Pselect, new Leveleditorselect (this,graphics ,Content ));
            StateManager.Add(gameState.win ,new GameWin(this,graphics,Content ));
        }
 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;
 }
示例#3
0
        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);*/
        }
示例#4
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;
        }
示例#5
0
 public override void Update(Game1 game, Audio audio)
 {
 }
示例#6
0
        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++;
        }
示例#7
0
        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;
        }
示例#8
0
        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;
        }
示例#9
0
        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 );
        }
示例#10
0
        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;
        }
示例#11
0
 public abstract void Update(Game1 game, Audio audio);