Пример #1
0
 //
 public void vidas(Sprite_Grafico colisao)
 {
     if (colisao is paletafixa && colisao.Dimensao.Intersects(this.Dimensao))
     {
         this.velocidadeVertical   = 0;
         this.velocidadeHorizontal = 0;
     }
 }
Пример #2
0
 public void DetectarColisao(Sprite_Grafico objeto)
 {
     if (objeto is Jogar && objeto.Dimensao.Intersects(this.Dimensao))
     {
         this.velocidadeVertical *= -1;
     }
     else if (objeto is Ladrilho && objeto.Dimensao.Intersects(this.Dimensao))
     {
         this.velocidadeVertical *= -1;
         ((Ladrilho)objeto).Destruir();
     }
 }
Пример #3
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);



            Fonte  = Content.Load <SpriteFont>("Font1");
            Fonte2 = Content.Load <SpriteFont>("Font2");


            somfundo = Content.Load <Song>("Fundomusical");
            zoeira   = Content.Load <Song>("zoeira");
            MediaPlayer.Play(zoeira);
            //MediaPlayer.Play(somfundo);

            fundo             = new Sprite_Grafico(Color.DarkSlateBlue, GraphicsDevice);
            fundo.Tamanho     = new Vector2(this.GraphicsDevice.Viewport.Height, GraphicsDevice.Viewport.Height - 20);
            fundo.Localizacao = new Vector2(10, 10);
            fundo.CarregarContent(Content);

            fixa = new paletafixa(Color.DarkSlateBlue, GraphicsDevice);
            fixa.CarregarContent(Content);
            fixa.Tamanho     = new Vector2(480, 1);
            fixa.Localizacao = new Vector2(10, 460);


            jogador = new Jogar(Color.White, GraphicsDevice);
            jogador.CarregarContent(Content);
            jogador.Tamanho     = new Vector2(70, 1);
            jogador.Localizacao = new Vector2(fundo.CentroX, fundo.Tamanho.Y - 15);
            jogador.Limite      = fundo.Dimensao;

            bolinha = new Bolinha(Color.Red, GraphicsDevice);
            bolinha.CarregarContent(Content);
            bolinha.Tamanho     = new Vector2(8, 8);
            bolinha.Localizacao = new Vector2(10, 120);
            bolinha.Limite      = fundo.Dimensao;

            DesenharLadrilhos();
        }