Exemplo n.º 1
0
        public void Shoot()
        {
            Bullets newBullet = new Bullets(RessourcesLoxi.BalleJoueur);

            newBullet.Speed = new Vector2((float)Math.Cos(AngleTir), (float)Math.Sin(AngleTir)) * 5f + Speed;
            if (flip == SpriteEffects.FlipHorizontally)
            {
                newBullet.Speed        = -newBullet.Speed;
                newBullet.SpriteEffect = flip;
            }
            else
            {
                newBullet.SpriteEffect = SpriteEffects.None;
            }

            newBullet.Position    = Position + newBullet.Speed * 5;
            newBullet.Position.Y -= RecPerso.Height;
            newBullet.isVisible   = true;

            if (bullets.Count() < 20)
            {
                bullets.Add(newBullet);
            }
        }