Example #1
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 #2
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 #3
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 #4
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);
        }