Beispiel #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;
        }
Beispiel #2
0
 void FormListener.updateLevel(Level level, int Formation)
 {
     _levelData = level;
 }
Beispiel #3
0
        private void newLevelButton_Click(object sender, EventArgs e)
        {
            Level newLevel = new Level();
            newLevel.levelName = "New Level";
            _levels.Add(newLevel);

            refreshLevelComboBox();
            refreshLevel();

            sendUpdate();
        }
Beispiel #4
0
 private void copyLevel_Click(object sender, EventArgs e)
 {
     copiedLevel = _levels[currLevel];
 }
 public LevelEditorScreen(PikeAndShotGame game, LevelConstructorForm form)
     : base(game)
 {
     _levelData = form.getCurrLevel();
     _pointerSprite = new Sprite(PikeAndShotGame.SWORD_POINTER, new Rectangle(0, 0, 18, 18), 18, 18);
     prevMouseState = Mouse.GetState();
     _grabbedThing = null;
     _grabbedThings = new ArrayList(30);
     _listener = form;
     _oldMousePosition = new Vector2(0f, 0f);
     _boxSelecting = false;
     _boxMoving = false;
 }
        void FormListener.updateLevel(Level level, int selectedFormation)
        {
            _levelData = level;

            foreach (EnemyFormation f in _enemyFormations)
            {
                _deadFormations.Add(f);
            }

            foreach (Terrain t in _terrain)
            {
                _deadThings.Add(t);
            }

            _enemyFormations.Clear();
            _terrain.Clear();

            for (int f = 0; f < _levelData.formations.Count; f++)
            {
                _newEnemyFormation = new EnemyFormation(_levelData.formationNames[f], _levelData.formationActions[f], this, (_levelData.formationPositions[f]).X, (_levelData.formationPositions[f]).Y, 5, _levelData.formationSides[f], f);

                for (int i = 0; i < _levelData.formations[f].Count; i++)
                {
                    switch ((_levelData.formations[f])[i])
                    {
                        case Soldier.CLASS_MERC_PIKEMAN:
                            _newEnemyFormation.addSoldier(new Pikeman(this, _newEnemyFormation.getPosition().X, _newEnemyFormation.getPosition().Y, SIDE_ENEMY));
                            break;
                        case Soldier.CLASS_MERC_ARQUEBUSIER:
                            _newEnemyFormation.addSoldier(new Arquebusier(this, _newEnemyFormation.getPosition().X, _newEnemyFormation.getPosition().Y, SIDE_ENEMY));
                            break;
                        case Soldier.CLASS_MERC_CROSSBOWMAN:
                            _newEnemyFormation.addSoldier(new Crossbowman(this, _newEnemyFormation.getPosition().X, _newEnemyFormation.getPosition().Y, SIDE_ENEMY));
                            break;
                        case Soldier.CLASS_MERC_SOLDIER:
                            _newEnemyFormation.addSoldier(new Targeteer(this, _newEnemyFormation.getPosition().X, _newEnemyFormation.getPosition().Y, SIDE_ENEMY));
                            break;
                        case Soldier.CLASS_GOBLIN_SLINGER:
                            _newEnemyFormation.addSoldier(new Slinger(this, _newEnemyFormation.getPosition().X, _newEnemyFormation.getPosition().Y, SIDE_ENEMY));
                            break;
                        case Soldier.CLASS_MERC_DOPPLE:
                            _newEnemyFormation.addSoldier(new Dopple(this, _newEnemyFormation.getPosition().X, _newEnemyFormation.getPosition().Y, SIDE_ENEMY));
                            break;
                        case Soldier.CLASS_GOBLIN_BERZERKER:
                            _newEnemyFormation.addSoldier(new Berzerker(this, _newEnemyFormation.getPosition().X, _newEnemyFormation.getPosition().Y, SIDE_ENEMY));
                            break;
                        case Soldier.CLASS_GOBLIN_BRIGAND:
                            _newEnemyFormation.addSoldier(new Brigand(this, _newEnemyFormation.getPosition().X, _newEnemyFormation.getPosition().Y, SIDE_ENEMY));
                            break;
                        case Soldier.CLASS_MERC_CROSSBOWMAN_PAVISE:
                            _newEnemyFormation.addSoldier(new CrossbowmanPavise(this, _newEnemyFormation.getPosition().X, _newEnemyFormation.getPosition().Y, SIDE_ENEMY));
                            break;
                        case Soldier.CLASS_MERC_CAVALRY:
                            _newEnemyFormation.addSoldier(new Cavalry(this, _newEnemyFormation.getPosition().X, _newEnemyFormation.getPosition().Y, SIDE_ENEMY));
                            break;
                        case Soldier.CLASS_GOBLIN_WOLF:
                            _newEnemyFormation.addSoldier(new Wolf(this, _newEnemyFormation.getPosition().X, _newEnemyFormation.getPosition().Y, SIDE_ENEMY));
                            break;
                        case Soldier.CLASS_NPC_FLEER:
                            _newEnemyFormation.addSoldier(new NPCFleer(this, _newEnemyFormation.getPosition().X, _newEnemyFormation.getPosition().Y, SIDE_NEUTRAL));
                            break;
                    }
                }
                _enemyFormations.Add(_newEnemyFormation);
            }

            for (int f = 0; f < _levelData.terrains.Count; f++)
            {
                Terrain.getNewTerrain(_levelData.terrains[f], this, _levelData.terrainPositions[f].X, _levelData.terrainPositions[f].Y, f);
            }

            if (selectedFormation != -1 && _enemyFormations.Count > selectedFormation)
            {
                ((EnemyFormation)_enemyFormations[selectedFormation]).selected = true;
            }
        }