Exemplo n.º 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>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                this.Exit();
            }



            tempoTiro--;

            posY1 = posY1 + 4;

            if (posY1 > 600)
            {
                posY1 = 0;
            }

            int rand = rnd.Next(-1000, 1000);

            if ((Math.Abs(rand) <= 0) || (go.obstaculosAtivos == 0))
            {
                obstaculo = go.gerarObstaculo();
            }

            Obstaculo[] obstaculos = go.toArray();

            for (int i = 0; i < obstaculos.Length; i++)
            {
                if (gt.verificarColisao(obstaculos[i]))
                {
                    obstaculos[i].atingido = true;
                    pontos += 1;
                }
            }



            aviao.Colisaodoavisao(obstaculos, aviao);
            Clickdomouse(mousestate.X, mousestate.Y);



            avaliarJogada();
            // TODO: Add your update logic here

            base.Update(gameTime);
        }