// TEST for now, move/delete later
    // currently because of this test, both characters shoot bullets affected by gravity
    private void spawnBullet()
    {
        RevolverBullet bullet = new RevolverBullet(this.x + this.width * direction.x, this.y + this.height * direction.y);

        bullet_handler.AddChild(bullet);

        if (direction.x == 1)
        {
            if (direction.y == 0)
            {
                bullet.rotation = 0;
            }
            else if (direction.y == -1)
            {
                bullet.rotation = 135;
            }
            else if (direction.y == 1)
            {
                bullet.rotation = 225;
            }
        }
        else if (direction.x == 0)
        {
            if (direction.y == -1)
            {
                bullet.rotation = 90;
            }
            else if (direction.y == 1)
            {
                bullet.rotation = 270;
            }
        }
        else if (direction.x == -1)
        {
            if (direction.y == 0)
            {
                bullet.rotation = 180;
            }
            else if (direction.y == -1)
            {
                bullet.rotation = 45;
            }
            else if (direction.y == 1)
            {
                bullet.rotation = 315;
            }
        }

        bullet.x_speed = 1.4f * direction.x;
        bullet.y_speed = 1.4f * direction.y;
    }
Ejemplo n.º 2
0
        public static void SpawnBullet(Vector2 position, bool right, BulletType type)
        {
            if (numberofBullets < 100)
            {
                switch (type)
                {
                case BulletType.revolver:
                    bullets[numberofBullets]            = new RevolverBullet(right);
                    bullets[numberofBullets++].position = position;
                    break;

                case BulletType.kanone:
                    bullets[numberofBullets]            = new KanoneBullet(right);
                    bullets[numberofBullets++].position = position;
                    break;

                case BulletType.seestern:
                    bullets[numberofBullets]            = new SeesternBullet(right);
                    bullets[numberofBullets++].position = position;
                    break;

                case BulletType.knife:
                    bullets[numberofBullets]            = new MesserBullet(right);
                    bullets[numberofBullets++].position = position;
                    break;

                case BulletType.cthullu:
                    bullets[numberofBullets]            = new CthulluBullet(right);
                    bullets[numberofBullets++].position = position;
                    break;

                case BulletType.seifenblase:
                    bullets[numberofBullets]            = new SeifenblaseBullet(right);
                    bullets[numberofBullets++].position = position;
                    break;

                case BulletType.regenbogen:
                    bullets[numberofBullets]            = new RegenbogenBullet(right);
                    bullets[numberofBullets++].position = position;
                    break;

                case BulletType.spitzspitz:
                    bullets[numberofBullets]            = new SpitzspitzBullet(right);
                    bullets[numberofBullets++].position = position;
                    break;
                }
            }
        }
Ejemplo n.º 3
0
        public static void Load(ContentManager contentManager)
        {
            ABullet a;

            a = new RevolverBullet(true);
            a.Load(contentManager, "");
            a = new KanoneBullet(true);
            a.Load(contentManager, "");
            a = new SeesternBullet(true);
            a.Load(contentManager, "");
            a = new MesserBullet(true);
            a.Load(contentManager, "");
            a = new CthulluBullet(true);
            a.Load(contentManager, "");
            a = new SeifenblaseBullet(true);
            a.Load(contentManager, "");
            a = new RegenbogenBullet(true);
            a.Load(contentManager, "");
            a = new SpitzspitzBullet(true);
            a.Load(contentManager, "");
        }