示例#1
0
 void spawnDashers(bool sideSpawn)
 {
     if (sideSpawn == true)
     {
         for (int i = 0; i < 5; i++)
         {
             GameNode node = null;
             node = new EnemyDasher(Config.EnemyDasherSpriteSheet);
             node.Position = new Vector2(50, 83 + (166 * i));
             node.Speed = Config.EnemyDasherSpeed;
             node.Direction = new Vector2(1, 0);
         }
         for (int i = 0; i < 5; i++)
         {
             GameNode node = null;
             node = new EnemyDasher(Config.EnemyDasherSpriteSheet);
             node.Position = new Vector2(1550, 166 + ((166 * i)));
             node.Speed = Config.EnemyDasherSpeed;
             node.Direction = new Vector2(-1, 0);
         }
     }
     else
     {
         for (int i = 0; i < 8; i++)
         {
             GameNode node = null;
             node = new EnemyDasher(Config.EnemyDasherSpriteSheet);
             node.Position = new Vector2(0 + (i * 200), 50);
             node.Speed = Config.EnemyDasherSpeed;
             node.Direction = new Vector2(0, 1);
         }
         for (int i = 0; i < 8; i++)
         {
             GameNode node = null;
             node = new EnemyDasher(Config.EnemyDasherSpriteSheet);
             node.Position = new Vector2(100 + (i * 200), 910);
             node.Speed = Config.EnemyDasherSpeed;
             node.Direction = new Vector2(0, -1);
         }
     }
 }
示例#2
0
        void SpawnItem(LevelItem_1 item)
        {
            GameNode node = null;

            if (item.Type == ItemType_1.EnemyInterceptor) node = new EnemyInterceptor(Config.EnemyInterceptorSpriteSheet);
            else if (item.Type == ItemType_1.EnemyAvoider) node = new EnemyAvoider(Config.EnemyAvoiderSpriteSheet);
            else if (item.Type == ItemType_1.EnemyChaser) node = new EnemyChaser(Config.EnemyChaserSpriteSheet);
            else if (item.Type == ItemType_1.EnemyDasher) node = new EnemyDasher(Config.EnemyDasherSpriteSheet);
            else if (item.Type == ItemType_1.EnemyShooter) node = new EnemyShooter(Config.EnemyShooterSpriteSheet);
            else if (item.Type == ItemType_1.PowerupHealth) node = new PowerupHealth(Config.PowerupSlowAllSpriteSheet);
            else if (item.Type == ItemType_1.PowerupMissiles) node = new PowerupMissiles(Config.PowerupMissileSpriteSheet);
            else if (item.Type == ItemType_1.PowerupWeaponAutoBurst) node = new PowerupWeaponAutoBurst(Config.PowerupSlowAllSpriteSheet);
            else if (item.Type == ItemType_1.boss1) node = new boss1(Config.BossSpriteSheet);
            else if (item.Type == ItemType_1.PowerupDamageAll) node = new PowerupDamageAll(Config.PowerupSlowAllSpriteSheet);
            else if (item.Type == ItemType_1.PowerupFreeze) node = new PowerupFreeze(Config.PowerupMissileSpriteSheet);
            else if (item.Type == ItemType_1.PowerupDoubleShot) node = new PowerupDoubleShot(Config.PowerupSlowAllSpriteSheet);
            else if (item.Type == ItemType_1.PowerupTripleShot) node = new PowerupTripleShot(Config.PowerupSlowAllSpriteSheet);
            else if (item.Type == ItemType_1.PowerupAddBullet) node = new PowerupAddBullet(Config.PowerupAddProjectileSpriteSheet);
            else if (item.Type == ItemType_1.PowerupShotSpeed) node = new PowerupShotSpeed(Config.PowerupProjectileSpeedSpriteSheet);
            else if (item.Type == ItemType_1.Coin) node = new Coin(Config.CoinSpriteSheet);

            if (node != null)
            {
                //TODO: suppy levelItem Y position from item
                //node.Position = new Vector2(item.PositionX, -node.Sprite.Origin.Y);
                node.Position = new Vector2(item.PositionX, item.PositionY);
                node.Speed = item.Speed;
                node.Direction = item.Direction;
            }

        }