Beispiel #1
0
        void randomSpawner()
        {
            if (difficulty > 1)
            {
                spawnMinTime = 5;
                spawnMaxTime = 11;
            }
            else
            {
                spawnMinTime = 10;
                spawnMaxTime = 16;
            }

            if (extraSpawnTimer > rand.Next(spawnMinTime, spawnMaxTime))
            {
                int random;
                GameNode node = null;

                if (difficulty > 1)
                {
                    random = rand.Next(0, 6);
                }
                else
                {
                    random = rand.Next(0, 5);
                }

                if (random == 5)
                {
                    node = new boss1(Config.BossSpriteSheet);
                    node.Speed = Config.BossSpeed;
                    node.Position = new Vector2(Config.Rand.Next(1550), Config.Rand.Next(910));
                }
                else if (random == 4)
                {
                    if (rand.Next(0, 2) == 0)
                    {
                        spawnDashers(true);
                    }
                    else
                    {
                        spawnDashers(false);
                    }
                }
                else
                {
                    for (int i = 0; i < 2 + difficulty; i++)
                    {
                        node = null;

                        switch (random)
                        {
                            case 0:
                                node = new EnemyChaser(Config.EnemyChaserSpriteSheet);
                                break;
                            case 1:
                                node = new EnemyShooter(Config.EnemyShooterSpriteSheet);
                                break;
                            case 2:
                                node = new EnemyInterceptor(Config.EnemyInterceptorSpriteSheet);
                                break;
                            case 3:
                                node = new EnemyAvoider(Config.EnemyAvoiderSpriteSheet);
                                break;
                        }

                        node.Position = new Vector2(Config.Rand.Next(1550), Config.Rand.Next(910));
                    }
                }
                extraSpawnTimer = 0;
            }
        }
Beispiel #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;
            }

        }