Esempio n. 1
0
        public LevelScreen(PikeAndShotGame game, Level level)
            : base(game)
        {
            _levelData = level;
            playerInPlay = false;

            _formation = new Formation(this, -300, PikeAndShotGame.SCREENHEIGHT/2 - Soldier.HEIGHT*5, 20, SIDE_PLAYER);
            if (PikeAndShotGame.TEST_BOSS)
                cFormation = new ColmillosFormation(this, 800, 500);
            //_formation.addSoldier(new Colmillos(this, 200, 200, BattleScreen.SIDE_PLAYER));
            //_formation.addSoldier(new Wolf(this, 200, 200, BattleScreen.SIDE_PLAYER));

            _formation.addSoldier(new Pikeman(this, _formation._position.X, _formation._position.Y, BattleScreen.SIDE_PLAYER));
            _formation.addSoldier(new Pikeman(this, _formation._position.X, _formation._position.Y, BattleScreen.SIDE_PLAYER));
            _formation.addSoldier(new Pikeman(this, _formation._position.X, _formation._position.Y, BattleScreen.SIDE_PLAYER));
            _formation.addSoldier(new Pikeman(this, _formation._position.X, _formation._position.Y, BattleScreen.SIDE_PLAYER));
            _formation.addSoldier(new Pikeman(this, _formation._position.X, _formation._position.Y, BattleScreen.SIDE_PLAYER));
            _formation.addSoldier(new Pikeman(this, _formation._position.X, _formation._position.Y, BattleScreen.SIDE_PLAYER));
            _formation.addSoldier(new Pikeman(this, _formation._position.X, _formation._position.Y, BattleScreen.SIDE_PLAYER));
            _formation.addSoldier(new Leader(this, _formation._position.X, _formation._position.Y, BattleScreen.SIDE_PLAYER));
            _formation.addSoldier(new Arquebusier(this, _formation._position.X, _formation._position.Y, BattleScreen.SIDE_PLAYER));
            _formation.addSoldier(new Arquebusier(this, _formation._position.X, _formation._position.Y, BattleScreen.SIDE_PLAYER));
            _formation.addSoldier(new Arquebusier(this, _formation._position.X, _formation._position.Y, BattleScreen.SIDE_PLAYER));
            _formation.addSoldier(new Arquebusier(this, _formation._position.X, _formation._position.Y, BattleScreen.SIDE_PLAYER));
            _formation.addSoldier(new Arquebusier(this, _formation._position.X, _formation._position.Y, BattleScreen.SIDE_PLAYER));
            _formation.addSoldier(new Arquebusier(this, _formation._position.X, _formation._position.Y, BattleScreen.SIDE_PLAYER));
            _formation.addSoldier(new Arquebusier(this, _formation._position.X, _formation._position.Y, BattleScreen.SIDE_PLAYER));

            _coins = MAX_COINS/2;
            _doubleCoins = 0;
            _coinSprites = new ArrayList(20);
            _doppelCoinSprites = new ArrayList(20);
            coinMeterPosition = new Vector2(COIN_METER_POSITION.X, COIN_METER_POSITION.Y);

            _usedFormations = new List<int>(_levelData != null ?_levelData.formations.Count:20);
            _usedTerrain = new List<int>(_levelData != null ? _levelData.formations.Count : 20);
            _spawners = new ArrayList(2);
            _deadSpawners = new ArrayList(2);

            for (int i = 0; i < _coins; i++)
            {
                _coinSprites.Add(new Coin(this, BASE_COIN_START_POSITION, new Vector2(BASE_COIN_POSITION.X, BASE_COIN_POSITION.Y - i * 4f)));
            }
            _coinMeter = new Sprite(PikeAndShotGame.COIN_METER, new Rectangle(0, 0, 36, 94), 36, 94, false, true, 128, new Color(Color.Yellow.R, Color.Yellow.G, 100), 2);
            _coinMeterHurt = new Sprite(PikeAndShotGame.COIN_METER, new Rectangle(0, 0, 36, 94), 36, 94, false, true, 128, Color.Red,2);
            _doppelMeter = new Sprite(PikeAndShotGame.DOPPEL_METER, new Rectangle(0, 0, 36, 100), 36, 100, false, true, 80, Color.White, 0.5f);
            _doppelMeterHurt = new Sprite(PikeAndShotGame.DOPPEL_METER, new Rectangle(0, 0, 36, 100), 36, 100, false, true, 80, Color.Red, 2f);
            _coinMeterTimer = 0f;
            lootSpills = new LootSpill[4];
            for (int i = 0; i < 4; i++)
            {
                lootSpills[i] = new LootSpill(this, Vector2.Zero, 0f, Vector2.Zero);
            }

            coinsDone = new ArrayList();

            shotSounds = new ArrayList(5);
            shotSounds.Add(PikeAndShotGame.SHOT_0.CreateInstance());
            shotSounds.Add(PikeAndShotGame.SHOT_1.CreateInstance());
            shotSounds.Add(PikeAndShotGame.SHOT_2.CreateInstance());
            shotSounds.Add(PikeAndShotGame.SHOT_3.CreateInstance());
            shotSounds.Add(PikeAndShotGame.SHOT_4.CreateInstance());

            foreach (SoundEffectInstance sfx in shotSounds)
                sfx.Volume = 0.5f;

            ((SoundEffectInstance)shotSounds[3]).Volume = 0.25f;
            ((SoundEffectInstance)shotSounds[4]).Volume = 0.25f;

            pikeSounds = new ArrayList(6);
            pikeSounds.Add(PikeAndShotGame.PIKE_0.CreateInstance());
            pikeSounds.Add(PikeAndShotGame.PIKE_1.CreateInstance());
            pikeSounds.Add(PikeAndShotGame.PIKE_2.CreateInstance());
            pikeSounds.Add(PikeAndShotGame.PIKE_3.CreateInstance());
            pikeSounds.Add(PikeAndShotGame.PIKE_4.CreateInstance());
            pikeSounds.Add(PikeAndShotGame.PIKE_5.CreateInstance());

            foreach (SoundEffectInstance sfx in pikeSounds)
                sfx.Volume = 0.5f;

            meleeSounds = new ArrayList(6);
            meleeSounds.Add(PikeAndShotGame.MELEE_CLANG_0.CreateInstance());
            meleeSounds.Add(PikeAndShotGame.MELEE_CLANG_1.CreateInstance());
            meleeSounds.Add(PikeAndShotGame.MELEE_CLANG_2.CreateInstance());
            meleeSounds.Add(PikeAndShotGame.MELEE_CLANG_0.CreateInstance());
            meleeSounds.Add(PikeAndShotGame.MELEE_CLANG_1.CreateInstance());
            meleeSounds.Add(PikeAndShotGame.MELEE_CLANG_2.CreateInstance());

            foreach (SoundEffectInstance sfx in meleeSounds)
                sfx.Volume = 0.25f;

            MediaPlayer.IsRepeating = true;
            MediaPlayer.Volume = 0.5f;
            //MediaPlayer.Play(PikeAndShotGame.THEME_1);

            spawnInitialTerrain();
            doppelType = true;
        }
Esempio n. 2
0
        public static void getNewSoldier(int soldierClass, BattleScreen screen, Formation _newEnemyFormation, float x, float y)
        {
            switch (soldierClass)
            {
                case Soldier.CLASS_MERC_PIKEMAN:
                    _newEnemyFormation.addSoldier(new Pikeman(screen, x, y, BattleScreen.SIDE_ENEMY));
                    break;
                case Soldier.CLASS_MERC_ARQUEBUSIER:
                    _newEnemyFormation.addSoldier(new Arquebusier(screen, x, y, BattleScreen.SIDE_ENEMY));
                    break;
                case Soldier.CLASS_MERC_CROSSBOWMAN:
                    _newEnemyFormation.addSoldier(new Crossbowman(screen, x, y, BattleScreen.SIDE_ENEMY));
                    break;
                case Soldier.CLASS_MERC_SOLDIER:
                    _newEnemyFormation.addSoldier(new Targeteer(screen, x, y, BattleScreen.SIDE_ENEMY));
                    break;
                case Soldier.CLASS_GOBLIN_SLINGER:
                    _newEnemyFormation.addSoldier(new Slinger(screen, x, y, BattleScreen.SIDE_ENEMY));
                    break;
                case Soldier.CLASS_MERC_DOPPLE:
                    _newEnemyFormation.addSoldier(new Dopple(screen, x, y, BattleScreen.SIDE_ENEMY));
                    break;
                case Soldier.CLASS_GOBLIN_BERZERKER:
                    _newEnemyFormation.addSoldier(new Berzerker(screen, x, y, BattleScreen.SIDE_ENEMY));
                    break;
                case Soldier.CLASS_GOBLIN_BRIGAND:
                    _newEnemyFormation.addSoldier(new Brigand(screen, x, y, BattleScreen.SIDE_ENEMY));
                    break;
                case Soldier.CLASS_MERC_CROSSBOWMAN_PAVISE:
                    _newEnemyFormation.addSoldier(new CrossbowmanPavise(screen, x, y, BattleScreen.SIDE_ENEMY));
                    break;
                case Soldier.CLASS_MERC_CAVALRY:
                    _newEnemyFormation.addSoldier(new Cavalry(screen, x, y, BattleScreen.SIDE_ENEMY));
                    break;
                case Soldier.CLASS_GOBLIN_WOLF:
                    _newEnemyFormation.addSoldier(new Wolf(screen, x, y, BattleScreen.SIDE_ENEMY));
                    break;
                case Soldier.CLASS_NPC_FLEER:
                    _newEnemyFormation.addSoldier(new NPCFleer(screen, x, y, BattleScreen.SIDE_ENEMY));
                    break;

            }
        }
Esempio n. 3
0
        internal void restart()
        {
            doppel = false;
            coinMeterPosition = COIN_METER_POSITION;
            _mapOffset.X = 0f;
            _mapOffset.Y = 0f;
            _usedFormations.Clear();
            _usedTerrain.Clear();
            _looseSoldiers.Clear();
            _shots.Clear();
            _enemyFormations.Clear();
            _formation.setPosition(200f, (float)PikeAndShotGame.SCREENHEIGHT * 0.5f);
            _formation.resetupFormation();
            _formation.reformFormation();
            _screenObjects.Clear();
            _screenObjectsToAdd.Clear();
            _screenColliders.Clear();
            _spawners.Clear();
            _screenAnimations.Clear();

            _coins = MAX_COINS/2;
            _doubleCoins = 0;
            _coinSprites.Clear();
            _doppelCoinSprites.Clear();
            for(int i = 0; i < _coins; i++)
            {
                _coinSprites.Add(new Coin(this, BASE_COIN_START_POSITION, new Vector2(BASE_COIN_POSITION.X, BASE_COIN_POSITION.Y - i * 4f)));
            }

            _formation = new Formation(this, 200, 200, 20, SIDE_PLAYER);
            //_formation.addSoldier(new Colmillos(this, 200, 200, BattleScreen.SIDE_PLAYER));

            _formation.addSoldier(new Pikeman(this, 200, 200, BattleScreen.SIDE_PLAYER));
            _formation.addSoldier(new Pikeman(this, 200, 200, BattleScreen.SIDE_PLAYER));
            _formation.addSoldier(new Pikeman(this, 200, 200, BattleScreen.SIDE_PLAYER));
            _formation.addSoldier(new Pikeman(this, 200, 200, BattleScreen.SIDE_PLAYER));
            _formation.addSoldier(new Pikeman(this, 200, 200, BattleScreen.SIDE_PLAYER));
            _formation.addSoldier(new Pikeman(this, 200, 200, BattleScreen.SIDE_PLAYER));
            _formation.addSoldier(new Pikeman(this, 200, 200, BattleScreen.SIDE_PLAYER));

            _formation.addSoldier(new Leader(this, 200, 200, BattleScreen.SIDE_PLAYER));

            _formation.addSoldier(new Arquebusier(this, 200, 200, BattleScreen.SIDE_PLAYER));
            _formation.addSoldier(new Arquebusier(this, 200, 200, BattleScreen.SIDE_PLAYER));
            _formation.addSoldier(new Arquebusier(this, 200, 200, BattleScreen.SIDE_PLAYER));
            _formation.addSoldier(new Arquebusier(this, 200, 200, BattleScreen.SIDE_PLAYER));
            _formation.addSoldier(new Arquebusier(this, 200, 200, BattleScreen.SIDE_PLAYER));
            _formation.addSoldier(new Arquebusier(this, 200, 200, BattleScreen.SIDE_PLAYER));
            _formation.addSoldier(new Arquebusier(this, 200, 200, BattleScreen.SIDE_PLAYER));

            foreach (Soldier s in _formation.getSoldiers())
            {
                _screenObjects.Add(s);
                s._position = new Vector2(200f, (float)PikeAndShotGame.SCREENHEIGHT * 0.5f);
            }

            _terrain = new ArrayList(20);

            spawnInitialTerrain();
            //MediaPlayer.Stop();
            //MediaPlayer.Play(PikeAndShotGame.THEME_1);
        }