示例#1
0
        /// <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>

        #region Update & Draw
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                this.Exit();
            }
            // TODO: Add your update logic here
            Global.clavier = Keyboard.GetState();
            if (Global.clavier.IsKeyDown(Keys.Escape))
            {
                this.Exit();
            }
            if (!endGame)
            {
                time += gameTime.ElapsedGameTime.TotalSeconds;
                placementLasers(laser, laser2);
                laser.Update(gameTime);
                laser2.Update(gameTime);

                placementLasers(laser3, laser4);
                // Délai entre les différents Laser

                if (time >= 1.3)
                {
                    laser3.Update(gameTime);
                    laser4.Update(gameTime);
                }
                vaisseau.Update(gameTime);
                vaisseauTouche();
                Invincibilite(gameTime);
                Score(gameTime);
                base.Update(gameTime);
            }
        }