Exemple #1
0
        public void CheckCollisionJog(Jogador jog)
        {
            if (Position.X + Texture.Width > jog.Position.X &&
                Position.X < jog.Position.X + jog.Texture.Width &&
                Position.Y + Texture.Height > jog.Position.Y &&
                Position.Y < jog.Position.Y + jog.Texture.Height)
            {
                this.Velocity.X *= -1;

                if (this.Velocity.X > 0)
                {
                    this.Velocity.X++;
                }
                if (this.Velocity.X < 0)
                {
                    this.Velocity.X--;
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            getScreenSize();
            jogador1 = new Jogador(290);
            jogador2 = new Jogador(290);
            font = Content.Load<SpriteFont>("Content/SpriteFont1");
            bola = new Bola();

            base.Initialize();
        }