Example #1
0
 public void addBomb(Character c, Color col, int damage)
 {
     Bullet b = new Bullet(explosionSprite, c.getPos(), new Vector2(0.0f, 0.0f), 1, levelManager, col, damage);
     b.setGrow(true, 0.13f);
     b.setStay(true);
     playerBullets.Add(b);
     soundManager.playerDeath();
 }
Example #2
0
        public void addBullet(Character c, Color col, int damage)
        {
            Vector2 vel = c.getVel() * 0.1f;
            vel += (new Vector2((float)Math.Cos(c.getRotation() - Math.PI / 2),
                (float)Math.Sin(c.getRotation() - Math.PI / 2))) * 4.0f;
            List<Bullet> l;

            if (c is Player)
            {
                vel *= 3.0f;
                l = playerBullets;
                soundManager.playerFire();
            }
            else
            {
                vel *= 1.5f;
                l = enemyBullets;
                if (enemyBullets.Count < 100)
                {
                    soundManager.enemyFire();
                }
            }

            Bullet b = new Bullet(bulletSprite, c.getPos(), vel, 1, levelManager, col, damage);
            b.setRotation(c.getRotation());
            l.Add(b);
        }
Example #3
0
 public void addSparks(Vector2 p, Vector2 vel)
 {
     int num = Game1.random.Next(0, 6);
     for (int i = 0; i < num; i++)
     {
         Vector2 v = new Vector2(Game1.random.Next(-3, 3), Game1.random.Next(-3, 3));
         Color col = new Color(255, Game1.random.Next(180, 256), 40);
         Bullet s = new Bullet(sparkSprite, p, v + vel, 1, levelManager, Color.Yellow, 0);
         s.setScale(0.5f);
         effects.Add(s);
     }
 }
Example #4
0
 public void addExplosion(Vector2 p, Vector2 vel, float scale, Color col)
 {
     Bullet s = new Bullet(explosionSprite, p, vel, 1, levelManager, col, 0);
     s.setScale(scale);
     s.setGrow(true, 0.06f);
     effects.Add(s);
 }