コード例 #1
0
 public override void Start()
 {
     base.Start();
     health      = obj.GetBehavior <enemyHealth>() as enemyHealth;
     health.boss = true;
     spawner     = obj.GetBehavior <BulletSpawner>() as BulletSpawner;
 }
コード例 #2
0
        static void spawnSun(Squared.Tiled.Object obj)
        {
            GameObject2d spawner = GameObject2d.Initialize();

            //TEMP
            Texture2D bulletSprite = content.Load <Texture2D>("bullet_1");

            spawner.sprite               = new AnimatedSprite(content.Load <Texture2D>("sunSprite"), 3, 1000, 1000, true, 0);
            spawner.sprite.Scale        *= 1;
            spawner.sprite.collisionBox *= 0.85f;
            spawner.sprite.LayerDepth    = 0.4f;
            spawner.addBehavior(new grazeEnemy());
            BulletSpawner b = new BulletSpawner();

            spawner.sprite.Position = new Vector2(obj.X, obj.Y);

            b.bulletSpeed  = 2;
            b.bulletAmount = 3;

            b.bulletfrequency = 0.05f; // ms

            b.spin = 0.3f;
            b.Wave = 0.2f;

            b.bulletSprite = bulletSprite;
            b.scale        = Vector2.One * 0.4f;
            spawner.addBehavior(b);


            // Bar
            Vector2 barscale = Vector2.One * 0.29f;
            Vector2 barPos   = new Vector2(300, 45);

            ProgressBar bar = ProgressBar.Initialize() as ProgressBar;

            bar.sprite            = new Sprite(content.Load <Texture2D>("bar"));
            bar.sprite.Position   = barPos;
            bar.sprite.Scale      = barscale;
            bar.sprite.LayerDepth = 0.01f;
            bar.sprite.enableCam  = false;

            bar.innerSprite           = new Sprite(content.Load <Texture2D>("inner"));
            bar.innerSprite.Position  = barPos;
            bar.innerSprite.Color     = Color.DarkRed;
            bar.innerSprite.Scale     = barscale;
            bar.innerSprite.enableCam = false;
            bar.value = 100;

            // more boss stuff?
            BossController boss = new BossController();

            boss.healthbar = bar;

            spawner.addBehavior(boss);
            var h = new enemyHealth();

            h.max = 20000;
            spawner.addBehavior(h);
        }
コード例 #3
0
 public override void Start()
 {
     base.Start();
     ran                  = new Random();
     health               = obj.GetBehavior <enemyHealth>() as enemyHealth;
     spawner              = obj.GetBehavior <BulletSpawner>() as BulletSpawner;
     spawner.scale        = Vector2.One * 0.5f;
     spawner.bulletSpeed  = 2;
     spawner.bulletSprite = bulletSprite;
 }