コード例 #1
0
        public Fase16(ContentManager Content, GameWindow gw)
        {
            this.gw = gw;
            autor   = "FASE 16 - Germano";

            _Content = Content;

            playing_musica = false;
            musica         = Content.Load <Song>("Kalimba");
            texturaFundo   = Content.Load <Texture2D>("Estados/Fase16/FundoFase16");
            texturaNave    = Content.Load <Texture2D>("Estados/Fase16/NaveFase16");
            posicao_j1.X   = (gw.ClientBounds.Width - texturaNave.Bounds.Width) / 2;
            posicao_j1.Y   = (gw.ClientBounds.Height - texturaNave.Bounds.Height) / 2;
            jogador1       = new Nave_jogador(1, texturaNave, posicao_j1, 0f, gw, Content);

            texturaInimigo        = Content.Load <Texture2D>("Estados/Fase02/nave_inimiga1");
            posicao_i1.X          = randomizador.Next(gw.ClientBounds.Width);
            posicao_i1.Y          = randomizador.Next(gw.ClientBounds.Height);
            inimigo1              = new Nave_inimigo(0, texturaInimigo, posicao_i1, 0f, gw, 15, Content, randomizador.Next(60));
            asteroide_gerenciador = new Asteroide(Content.Load <Texture2D>("Asteroides"), Vector2.Zero, 0.0f, gw, Content);

            for (int i = 0; i < qtdInimigos; i++)
            {
                posicao_i1.X = randomizador.Next(gw.ClientBounds.Width);
                posicao_i1.Y = randomizador.Next(gw.ClientBounds.Height);
                inimigo1     = new Nave_inimigo(0, texturaInimigo, posicao_i1, 0f, gw, 15, Content, randomizador.Next(60));
                listaInimigos.Add(inimigo1);
            }
        }
コード例 #2
0
        public void Update(GameTime gameTime, KeyboardState teclado, KeyboardState tecladoAnterior, GamePadState _controle, GamePadState _controleanterior)
        {
            //if (!playing_musica)
            //{
            //    MediaPlayer.Play(musica);
            //    playing_musica = true;
            //}

            jogador1.Update(gameTime, teclado, tecladoAnterior, _controle, _controleanterior);

            for (int i = 0; i < listaInimigos.Count; i++)
            {
                listaInimigos[i].Update(gameTime);
            }

            for (int i = 0; i < Shot.listaTiros.Count; i++)
            {
                for (int j = 0; j < listaInimigos.Count; j++)
                {
                    if (Shot.listaTiros[i].Colisao(listaInimigos[j].hitBox))
                    {
                        listaInimigos.RemoveAt(j);
                    }
                }
            }


            if (listaInimigos.Count < qtdInimigos)
            {
                posicao_i1.X = randomizador.Next(gw.ClientBounds.Width);
                posicao_i1.Y = randomizador.Next(gw.ClientBounds.Height);
                inimigo1     = new Nave_inimigo(0, texturaInimigo, posicao_i1, 0f, gw, 15, _Content, randomizador.Next(60));
                listaInimigos.Add(inimigo1);
            }
        }
コード例 #3
0
        public Fase13(ContentManager Content, GameWindow gw)
        {
            this.gw = gw;
            autor   = "FASE 13 - Pedro";

            _Content = Content;

            //playing_musica = false;
            //musica = Content.Load<Song>("Estados/Fase02/musica_fase2");
            texturaFundo = Content.Load <Texture2D>("Estados/Fase13/bg");
            texturaNave  = Content.Load <Texture2D>("Estados/Fase13/naveFase13");
            posicao_j1.X = (gw.ClientBounds.Width - texturaNave.Bounds.Width) / 2;
            posicao_j1.Y = (gw.ClientBounds.Height - texturaNave.Bounds.Height) / 2;
            jogador1     = new Nave_jogador(1, texturaNave, posicao_j1, 0f, gw, Content);

            texturaInimigo = Content.Load <Texture2D>("Estados/Fase02/nave_inimiga1");

            for (int i = 0; i < qtdInimigos; i++)
            {
                posicao_i1.X = randomizador.Next(gw.ClientBounds.Width);
                posicao_i1.Y = randomizador.Next(gw.ClientBounds.Height);
                inimigo1     = new Nave_inimigo(0, texturaInimigo, posicao_i1, 0f, gw, 15, Content, randomizador.Next(60));
                listaInimigos.Add(inimigo1);
            }
        }
コード例 #4
0
        public void Update(GameTime gameTime, KeyboardState teclado, KeyboardState tecladoAnterior, GamePadState _controle, GamePadState _controleanterior)
        {
            if (!playing_musica)
            {
                MediaPlayer.Play(musica);
                playing_musica = true;
            }

            if ((teclado.IsKeyDown(Keys.PageUp)) && !(tecladoAnterior.IsKeyDown(Keys.PageUp)))
            {
                MediaPlayer.Volume += 0.1f;
            }

            if ((teclado.IsKeyDown(Keys.PageDown)) && !(tecladoAnterior.IsKeyDown(Keys.PageDown)))
            {
                MediaPlayer.Volume -= 0.1f;
            }
            jogador1.Update(gameTime, teclado, tecladoAnterior, _controle, _controleanterior);
            asteroide_gerenciador.Update(gameTime);

            for (int i = 0; i < listaInimigos.Count; i++)
            {
                listaInimigos[i].Update(gameTime);
            }

            for (int i = 0; i < Shot.listaTiros.Count; i++)
            {
                for (int j = 0; j < listaInimigos.Count; j++)
                {
                    if (Shot.listaTiros[i].Colisao(listaInimigos[j].hitBox))
                    {
                        listaInimigos.RemoveAt(j);
                    }
                }
            }


            if (listaInimigos.Count < qtdInimigos)
            {
                posicao_i1.X = randomizador.Next(gw.ClientBounds.Width);
                posicao_i1.Y = randomizador.Next(gw.ClientBounds.Height);
                inimigo1     = new Nave_inimigo(0, texturaInimigo, posicao_i1, 0f, gw, 15, _Content, randomizador.Next(60));
                listaInimigos.Add(inimigo1);
            }
        }
コード例 #5
0
        public Fase11(ContentManager Content, GameWindow gw)
        {
            this.gw = gw;
            autor   = "FASE 11 - Marcos - NÃO IMPLEMENTADA";

            playing_musica = false;
            musica         = Content.Load <Song>("Estados/Fase02/musica_fase2");
            texturaFundo   = Content.Load <Texture2D>("Estados/Fase02/fundoFase2");
            texturaNave    = Content.Load <Texture2D>("Estados/Fase02/naveFase2");
            posicao_j1.X   = (gw.ClientBounds.Width - texturaNave.Bounds.Width) / 2;
            posicao_j1.Y   = (gw.ClientBounds.Height - texturaNave.Bounds.Height) / 2;
            jogador1       = new Nave_jogador(1, texturaNave, posicao_j1, 0f, gw, Content);

            texturaInimigo = Content.Load <Texture2D>("Estados/Fase02/nave_inimiga1");
            posicao_i1.X   = randomizador.Next(gw.ClientBounds.Width);
            posicao_i1.Y   = randomizador.Next(gw.ClientBounds.Height);
            inimigo1       = new Nave_inimigo(1, texturaInimigo, posicao_i1, 0f, gw, 15, Content);
        }
コード例 #6
0
        public Fase7(ContentManager Content, GameWindow Window)
        {
            #region loads principais
            this.gw = Window;
            autor   = "FASE 7 - Gabriel Henrique";
            Texture2D texturaNave = Content.Load <Texture2D>(Endereco + "Nave");
            fundo1    = Content.Load <Texture2D>(Endereco + "Galaxia");
            fundo2    = Content.Load <Texture2D>(Endereco + "Galaxia");
            musica    = Content.Load <Song>(Endereco + "Space music");
            posicao.X = Window.ClientBounds.Width / 2 - texturaNave.Width / 2;
            posicao.Y = Window.ClientBounds.Height / 2 - texturaNave.Height / 2;
            //jogador1 = new NaveGabriel(texturaNave, Color.White, posicao, 0f, "Teste", 3, 0, Window, texturaEscudo, Content.Load<SoundEffect>("chord"), texturaTiro, texturaBarra);
            jogador1       = new Nave_jogador(1, texturaNave, posicao, 0f, gw, Content);
            Texto.X        = 0;
            Texto.Y        = Window.ClientBounds.Height - 30;
            jogador1.morto = false;
            #endregion
            #region Load do fundo
            Tamanho1.Width  = gw.ClientBounds.Width;
            Tamanho1.Height = gw.ClientBounds.Height;
            Tamanho1.X      = 0;
            Tamanho1.Y      = 0;

            Tamanho2.Width  = gw.ClientBounds.Width;
            Tamanho2.Height = gw.ClientBounds.Height;
            Tamanho2.X      = gw.ClientBounds.Width;
            Tamanho2.Y      = 0;
            #endregion
            #region Load do inimigo
            texturaI = Content.Load <Texture2D>(Endereco + "asteroid");
            posI.X   = 100;
            posI.Y   = 100;
            inimigo  = new Nave_inimigo(1, texturaI, posI, 0f, gw, 3, Content);
            inimigos.Add(inimigo);
            texturaI = Content.Load <Texture2D>(Endereco + "asteroid");
            posI.X   = 500;
            posI.Y   = 400;
            inimigo  = new Nave_inimigo(1, texturaI, posI, 0f, gw, 3, Content);
            inimigos.Add(inimigo);
            #endregion
        }
コード例 #7
0
        public Fase12(ContentManager Content, GameWindow gw)
        {
            this.gw = gw;
            autor   = "FASE 12 - Paulo Roberto";

            _Content = Content;

            inimigosRestantes = 5;

            #region music
            playing_musica = false;
            musica         = Content.Load <Song>("Estados/Fase03/fase3");
            #endregion

            texturaFundo = Content.Load <Texture2D>("Estados/Fase12/FundoFase12");
            texturaNave  = Content.Load <Texture2D>("Estados/Fase02/naveFase2");
            posicao_j1.X = (gw.ClientBounds.Width - texturaNave.Bounds.Width) / 2;
            posicao_j1.Y = (gw.ClientBounds.Height - texturaNave.Bounds.Height) / 2;
            jogador1     = new Nave_jogador(1, texturaNave, posicao_j1, 0, gw, Content);

            texturaInimigo = Content.Load <Texture2D>("Estados/Fase02/nave_inimiga1");
            posicao_i1.X   = randomizador.Next(gw.ClientBounds.Width);
            posicao_i1.Y   = randomizador.Next(gw.ClientBounds.Height);


            for (int i = 0; i < 5; i++)
            {
                posicao_i1.X = randomizador.Next(gw.ClientBounds.Width);
                posicao_i1.Y = randomizador.Next(gw.ClientBounds.Height);
                inimigo1     = new Nave_inimigo(0, texturaInimigo, posicao_i1, 0f, gw, 15, Content, randomizador.Next(60));
                listaInimigos.Add(inimigo1);
            }

            asteroide_gerenciador = new Asteroide(
                Content.Load <Texture2D>("Asteroides"),
                Vector2.Zero,
                0.0f,
                gw,
                Content
                );
        }
コード例 #8
0
        /// <summary>
        /// Construtor da fase1
        /// </summary>
        public Fase3(ContentManager Content, GameWindow gw)
        {
            this.gw = gw;
            autor   = "FASE 3 - Daniel Coimbra";

            _Content = Content;

            #region init audio
            playing_musica = false;
            musica         = Content.Load <Song>(file_path + "fase3");
            #endregion

            inimigosRestantes = 5;
            texturaFundo      = Content.Load <Texture2D>(file_path + "fundo_fase3");
            texturaNave       = Content.Load <Texture2D>(file_path + "Nave_fase3");
            posicao_j1.X      = (gw.ClientBounds.Width / 2) - texturaNave.Width / 2 - 150;
            posicao_j1.Y      = (gw.ClientBounds.Height / 2) - texturaNave.Height / 2;
            jogador1          = new Nave_jogador(1, texturaNave, posicao_j1, 0f, gw, Content);

            texturaInimigo = Content.Load <Texture2D>(file_path + "nave_inimiga");

            for (int i = 0; i < 5; i++)
            {
                posicao_i1.X = randomizador.Next(gw.ClientBounds.Width);
                posicao_i1.Y = randomizador.Next(gw.ClientBounds.Height);
                inimigo1     = new Nave_inimigo(0, texturaInimigo, posicao_i1, 0f, gw, 15, Content, randomizador.Next(60));
                listaInimigos.Add(inimigo1);
            }

            asteroide_gerenciador = new Asteroide(
                Content.Load <Texture2D>("Asteroides"),
                Vector2.Zero,
                0.0f,
                gw,
                Content
                );
        }