Пример #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);


            // TODO: use this.Content to load your game content here
            font          = Content.Load <SpriteFont>("Font");
            fundo         = Content.Load <Texture2D>("fundo");
            fundo2        = Content.Load <Texture2D>("fundo");
            posicaoFundo2 = new Vector2(posicaoFundo.X - fundo.Width, posicaoFundo.Y);
            Texture2D texturaBarra = Content.Load <Texture2D>("barra");

            barraEsquerda       = new Barra(Content.Load <Texture2D>("barra_esquerda"), new Vector2(10, 10), new Vector2(20, tela.Y / 2), tela, Keys.W, Keys.S);
            barraDireita        = new Barra(Content.Load <Texture2D>("barra_direita"), new Vector2(10, 10), new Vector2(tela.X - (20 + texturaBarra.Width), tela.Y / 2), tela, Keys.Up, Keys.Down);
            bola                = new Bola(Content.Load <Texture2D>("bola"), new Vector2(5, 5), new Vector2(tela.X / 2, tela.Y / 2), tela, barraEsquerda, barraDireita);
            bola.TexturaColisao = Content.Load <Texture2D>("bola-efeito");
            particleManager     = new ParticleManager(Content.Load <Texture2D>("efeito"), bola.Posicao);
            bola.efeito         = Content.Load <Texture2D>("efeito");

            // Som
            bola.AudioEngine = new AudioEngine(@"Content\Sounds.xgs");
            bola.WaveBank    = new WaveBank(bola.AudioEngine, @"Content\Wave Bank.xwb");
            bola.SoundBank   = new SoundBank(bola.AudioEngine, @"Content\Sound Bank.xsb");
        }
Пример #2
0
 public Bola(Texture2D textura, Vector2 velocidade, Vector2 posicao, Vector2 tamanhoTela, Barra barraEsquerda, Barra barraDireita)
 {
     this.textura       = textura;
     this.velocidade    = velocidade;
     this.posicao       = posicao;
     this.tamanhoTela   = tamanhoTela;
     this.barraEsquerda = barraEsquerda;
     this.barraDireita  = barraDireita;
 }
Пример #3
0
 public Bola(Texture2D textura, Vector2 velocidade, Vector2 posicao, Vector2 tamanhoTela, Barra barraEsquerda, Barra barraDireita)
 {
     this.textura = textura;
     this.velocidade = velocidade;
     this.posicao = posicao;
     this.tamanhoTela = tamanhoTela;
     this.barraEsquerda = barraEsquerda;
     this.barraDireita = barraDireita;
 }
Пример #4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            font = Content.Load<SpriteFont>("Font");
            fundo = Content.Load<Texture2D>("fundo");
            fundo2 = Content.Load<Texture2D>("fundo");
            posicaoFundo2 = new Vector2(posicaoFundo.X - fundo.Width, posicaoFundo.Y);
            Texture2D texturaBarra = Content.Load<Texture2D>("barra");
            barraEsquerda = new Barra(Content.Load<Texture2D>("barra_esquerda"), new Vector2(10, 10), new Vector2(20, tela.Y / 2), tela, Keys.W, Keys.S);
            barraDireita = new Barra(Content.Load<Texture2D>("barra_direita"), new Vector2(10, 10), new Vector2(tela.X - (20 + texturaBarra.Width) , tela.Y / 2), tela, Keys.Up, Keys.Down);
            bola = new Bola(Content.Load<Texture2D>("bola"), new Vector2(5, 5), new Vector2(tela.X / 2, tela.Y / 2), tela, barraEsquerda, barraDireita);
            bola.TexturaColisao = Content.Load<Texture2D>("bola-efeito");
            particleManager = new ParticleManager(Content.Load<Texture2D>("efeito"), bola.Posicao);
            bola.efeito = Content.Load<Texture2D>("efeito");

            // Som
            bola.AudioEngine = new AudioEngine(@"Content\Sounds.xgs");
            bola.WaveBank = new WaveBank(bola.AudioEngine, @"Content\Wave Bank.xwb");
            bola.SoundBank = new SoundBank(bola.AudioEngine, @"Content\Sound Bank.xsb");
        }
Пример #5
0
 protected override void LoadContent()
 {
     // Create a new SpriteBatch, which can be used to draw textures.
     spriteBatch = new SpriteBatch(GraphicsDevice);
     // Carrega a imagem de fundo do jogo
     background = Content.Load<Texture2D>(@"Imagens\gameplay");
     // Instância a bola
     bola = new Bola(this, new Vector2(386.0f, 310.0f));
     // Instância o primeiro barra
     barra1 = new Barra(this, new Vector2(10.0f, 290.0f));
     // Instância o segundo jogador
     barra2 = new Barra(this, new Vector2(765.0f, 290.0f));
     // Carrega a font para escrita
     fontScore = Content.Load<SpriteFont>(@"Fonts\score");
     // Carrega o efeito sonoro da colisão da bola com o campo
     soundToc1 = Content.Load<SoundEffect>(@"Audio\toc_1");
     // Carrega o efeito sonoro da colisão da bola com as barras
     soundToc2 = Content.Load<SoundEffect>(@"Audio\toc_2");
     // Carrega ó efeito sonoro para quando marcar pontos
     soundPoint = Content.Load<SoundEffect>(@"Audio\point");
     // Carrega a música de fundo do jogo
     music = Content.Load<Song>(@"Audio\music");
     // Carrega a textura da tela inicial
     intro = Content.Load<Texture2D>(@"Imagens\intro");
     // Carrega a textura de game over
     gameover = Content.Load<Texture2D>(@"Imagens\gameover");
     // Toca a música de fundo
     MediaPlayer.Play(music);
     // Coloca a música de fundo em loop infinito
     MediaPlayer.IsRepeating = true;
 }