예제 #1
0
 public FormationEditorScreen(PikeAndShotGame game)
     : base(game)
 {
     _formation = new Formation(this, 600, 200, 5, SIDE_ENEMY);
     _pattern = new List<LevelPipeline.PatternActionContent>();
     _actions = new List<int>(1);
     _actions.Add(PatternAction.ACTION_IDLE);
     _currPatternAction = new LevelPipeline.PatternActionContent(_actions, 0f);
     _fileCount = 0;
 }
예제 #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;

            }
        }
예제 #3
0
        public Dopple(BattleScreen screen, float x, float y, int side)
            : base(screen, side, x, y)
        {
            _type = Soldier.TYPE_SWINGER;
            _class = Soldier.CLASS_MERC_DOPPLE;
            _attackTime = 300f;
            _reloadTime = 500f;
            guardTargetDist = (float)getWidth()*3f;
            guardTargetRange = 2000f;
            breakRange = Soldier.WIDTH * 1000f;
            _chargeTime = 200f;

            _feet = new Sprite(PikeAndShotGame.PIKEMAN_FEET, new Rectangle(4, 2, 16, 12), 26, 16, true);
            _idle = new Sprite(PikeAndShotGame.DOPPLE_IDLE, new Rectangle(20, 6, 16, 28), 44, 42);
            _death = new Sprite(PikeAndShotGame.DOPPLE_DEATH, new Rectangle(40, 2, 16, 28), 72, 40);
            _melee1 = new Sprite(PikeAndShotGame.DOPPLE_SWING1, new Rectangle(24, 20, 16, 28), 76, 68);
            _defend1 = new Sprite(PikeAndShotGame.DOPPLE_RELOAD1, new Rectangle(24, 16, 16, 28), 76, 64);
            _route = new Sprite(PikeAndShotGame.DOPPLE_ROUTE, new Rectangle(30, 12, 16, 28), 76, 48);
            _routed = new Sprite(PikeAndShotGame.DOPPLE_ROUTED, new Rectangle(30, 12, 16, 28), 76, 49, true);
            _doppleReload1 = new Sprite(PikeAndShotGame.DOPPLE_RELOAD1, new Rectangle(24, 16, 16, 28), 76, 64);
            _doppleSwing1 = new Sprite(PikeAndShotGame.DOPPLE_SWING1, new Rectangle(24, 20, 16, 28), 76, 68);

            _feet.setAnimationSpeed(_footSpeed / 0.11f);
            _weaponSwing = new WeaponSwing(_screen, this);
            _screen.removeScreenObject(_weaponSwing);
            playerFormation = _screen.getPlayerFormation();
            _speed = 0.15f;
            possibleTargets = new ArrayList(5);
            slashSound = PikeAndShotGame.SLASH.CreateInstance();
        }
예제 #4
0
 public void removeEnemyFormation(Formation enemyFormation)
 {
     _enemyFormations.Remove(enemyFormation);
 }
예제 #5
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;
        }
예제 #6
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);
        }
예제 #7
0
        protected override void getInput(TimeSpan timeSpan)
        {
            keyboardState = Keyboard.GetState();
            gamePadState = GamePad.GetState(PlayerIndex.One);

            if (_pattern.Count == 0)
                _actionStart = timeSpan.TotalSeconds;

            // Allows the game to exit
            if (keyboardState.IsKeyDown(Keys.Escape) || GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                _game.Exit();

            if (keyboardState.IsKeyDown(Keys.Left) || gamePadState.IsButtonDown(Buttons.DPadLeft))
            {
                if ((keyboardState.IsKeyDown(Keys.Up) || gamePadState.IsButtonDown(Buttons.DPadUp)) || (keyboardState.IsKeyDown(Keys.Down) || gamePadState.IsButtonDown(Buttons.DPadDown)))
                    _formation.marchLeft(timeSpan.TotalMilliseconds, true);
                else
                    _formation.marchLeft(timeSpan.TotalMilliseconds, false);
            }
            if (keyboardState.IsKeyDown(Keys.Right) || gamePadState.IsButtonDown(Buttons.DPadRight))
            {
                if ((keyboardState.IsKeyDown(Keys.Up) || gamePadState.IsButtonDown(Buttons.DPadUp)) || (keyboardState.IsKeyDown(Keys.Down) || gamePadState.IsButtonDown(Buttons.DPadDown)))
                {
                    _formation.marchRight(timeSpan.TotalMilliseconds, true);
                    if (_formation.getCenter().X >= PikeAndShotGame.SCREENWIDTH * BattleScreen.SCROLLPOINT + _mapOffset.X)
                        _mapOffset.X += _formation.getSpeed() * (float)timeSpan.TotalMilliseconds * 0.708f * 0.75f;
                }
                else
                {
                    _formation.marchRight(timeSpan.TotalMilliseconds, false);
                    if (_formation.getCenter().X >= PikeAndShotGame.SCREENWIDTH * BattleScreen.SCROLLPOINT + _mapOffset.X)
                        _mapOffset.X += _formation.getSpeed() * (float)timeSpan.TotalMilliseconds * 0.75f;
                }

            }
            else
            {
                if (_formation.getCenter().X >= PikeAndShotGame.SCREENWIDTH * BattleScreen.SCROLLPOINT + _mapOffset.X)
                    _mapOffset.X += getScrollAdjustSpeed() * (float)timeSpan.TotalMilliseconds;
            }
            if (keyboardState.IsKeyDown(Keys.Down) || gamePadState.IsButtonDown(Buttons.DPadDown))
            {
                if ((keyboardState.IsKeyDown(Keys.Left) || gamePadState.IsButtonDown(Buttons.DPadLeft)) || (keyboardState.IsKeyDown(Keys.Right) || gamePadState.IsButtonDown(Buttons.DPadRight)))
                {
                    _formation.marchDown(timeSpan.TotalMilliseconds, true);
                    //if (_mapOffset.Y < BattleScreen.BATTLEHEIGHTEXTEND && _formation.getCenter().Y - _mapOffset.Y >= PikeAndShotGame.SCREENHEIGHT * 0.5f)
                    // _mapOffset.Y += _formation.getSpeed() * (float)timeSpan.TotalMilliseconds * 0.708f;
                }
                else
                {
                    _formation.marchDown(timeSpan.TotalMilliseconds, false);
                    // if (_mapOffset.Y < BattleScreen.BATTLEHEIGHTEXTEND && _formation.getCenter().Y - _mapOffset.Y >= PikeAndShotGame.SCREENHEIGHT * 0.5f)
                    //   _mapOffset.Y += _formation.getSpeed() * (float)timeSpan.TotalMilliseconds;
                }
            }
            if (keyboardState.IsKeyDown(Keys.Up) || gamePadState.IsButtonDown(Buttons.DPadUp))
            {
                if ((keyboardState.IsKeyDown(Keys.Left) || gamePadState.IsButtonDown(Buttons.DPadLeft)) || (keyboardState.IsKeyDown(Keys.Right) || gamePadState.IsButtonDown(Buttons.DPadRight)))
                {
                    _formation.marchUp(timeSpan.TotalMilliseconds, true);
                    //if (_mapOffset.Y > -1 * BattleScreen.BATTLEHEIGHTEXTEND && _formation.getCenter().Y - _mapOffset.Y <= PikeAndShotGame.SCREENHEIGHT * 0.5f)
                    //_mapOffset.Y -= _formation.getSpeed() * (float)timeSpan.TotalMilliseconds * 0.708f;
                }
                else
                {
                    _formation.marchUp(timeSpan.TotalMilliseconds, false);
                    //if (_mapOffset.Y > -1 * BattleScreen.BATTLEHEIGHTEXTEND && _formation.getCenter().Y - _mapOffset.Y <= PikeAndShotGame.SCREENHEIGHT * 0.5f)
                    //_mapOffset.Y -= _formation.getSpeed() * (float)timeSpan.TotalMilliseconds;
                }
            }
            if ((keyboardState.IsKeyDown(Keys.Z) && previousKeyboardState.IsKeyUp(Keys.Z)) || (gamePadState.IsButtonDown(Buttons.A) && previousGamePadState.IsButtonUp(Buttons.A)))
            {
                _formation.pikeAttack();
            }
            else if ((previousKeyboardState.IsKeyDown(Keys.Z) && keyboardState.IsKeyUp(Keys.Z)) || (previousGamePadState.IsButtonDown(Buttons.A) && gamePadState.IsButtonUp(Buttons.A)))
            {
                _formation.pikeRaise();
            }
            if ((keyboardState.IsKeyDown(Keys.Z) && keyboardState.IsKeyDown(Keys.X) && (previousKeyboardState.IsKeyUp(Keys.Z) || previousKeyboardState.IsKeyUp(Keys.X))) || (gamePadState.IsButtonDown(Buttons.A) && gamePadState.IsButtonDown(Buttons.X) && (previousGamePadState.IsButtonUp(Buttons.A) || previousGamePadState.IsButtonUp(Buttons.X))))
            {
                //_formation.meleeCharge();
                //_formation.swingAttack();
            }
            else if ((keyboardState.IsKeyUp(Keys.Z) || keyboardState.IsKeyUp(Keys.X)) && (previousKeyboardState.IsKeyDown(Keys.Z) && previousKeyboardState.IsKeyDown(Keys.X)))
            {
                _formation.cancelCharge();
            }
            else if ((gamePadState.IsButtonUp(Buttons.A) || gamePadState.IsButtonUp(Buttons.X)) && (previousGamePadState.IsButtonDown(Buttons.A) && previousGamePadState.IsButtonDown(Buttons.X)))
            {
                _formation.cancelCharge();
            }
            //if ((keyboardState.IsKeyDown(Keys.Z) && keyboardState.IsKeyUp(Keys.X) && previousKeyboardState.IsKeyDown(Keys.X)) || (gamePadState.IsButtonDown(Buttons.A) && gamePadState.IsButtonUp(Buttons.X) && previousGamePadState.IsButtonDown(Buttons.X)))
            //{
            //    _formation.swingRelease();
            //}
            if ((keyboardState.IsKeyDown(Keys.X) && !keyboardState.IsKeyDown(Keys.Z)) || (gamePadState.IsButtonDown(Buttons.X) && !gamePadState.IsButtonDown(Buttons.A)))
            {
                _formation.shotAttack();
            }
            if (keyboardState.IsKeyUp(Keys.X) && gamePadState.IsButtonUp(Buttons.X))
            {
                _formation.needTriggerUp = false;
            }
            if (keyboardState.IsKeyDown(Keys.Q) && previousKeyboardState.IsKeyUp(Keys.Q))
            {
                _formation.addSoldier(new Pikeman(this, getMapOffset().X, getMapOffset().Y + PikeAndShotGame.SCREENHEIGHT * 0.5f, SIDE_PLAYER));
            }
            if (keyboardState.IsKeyDown(Keys.W) && previousKeyboardState.IsKeyUp(Keys.W))
            {
                _formation.addSoldier(new Arquebusier(this, getMapOffset().X, getMapOffset().Y + PikeAndShotGame.SCREENHEIGHT * 0.5f, SIDE_PLAYER));
            }
            if (keyboardState.IsKeyDown(Keys.E) && previousKeyboardState.IsKeyUp(Keys.E))
            {
                _formation.addSoldier(new Crossbowman(this, getMapOffset().X, getMapOffset().Y + PikeAndShotGame.SCREENHEIGHT * 0.5f, SIDE_PLAYER));
            }
            if (keyboardState.IsKeyDown(Keys.R) && previousKeyboardState.IsKeyUp(Keys.R))
            {
                _formation.addSoldier(new Slinger(this, getMapOffset().X, getMapOffset().Y + PikeAndShotGame.SCREENHEIGHT * 0.5f, SIDE_PLAYER));
            }
            if (keyboardState.IsKeyDown(Keys.T) && previousKeyboardState.IsKeyUp(Keys.T))
            {
                _formation.addSoldier(new Dopple(this, getMapOffset().X, getMapOffset().Y + PikeAndShotGame.SCREENHEIGHT * 0.5f, SIDE_PLAYER));
            }
            if (keyboardState.IsKeyDown(Keys.Y) && previousKeyboardState.IsKeyUp(Keys.Y))
            {
                _formation.addSoldier(new Berzerker(this, getMapOffset().X, getMapOffset().Y + PikeAndShotGame.SCREENHEIGHT * 0.5f, SIDE_PLAYER));
            }
            if (keyboardState.IsKeyDown(Keys.P) && previousKeyboardState.IsKeyUp(Keys.P))
            {
                _formation.addSoldier(new CrossbowmanPavise(this, getMapOffset().X, getMapOffset().Y + PikeAndShotGame.SCREENHEIGHT * 0.5f, SIDE_PLAYER));
            }
            if (keyboardState.IsKeyDown(Keys.U) && previousKeyboardState.IsKeyUp(Keys.U))
            {
                _formation.addSoldier(new Cavalry(this, getMapOffset().X, getMapOffset().Y + PikeAndShotGame.SCREENHEIGHT * 0.5f, SIDE_PLAYER));
            }
            if (keyboardState.IsKeyDown(Keys.I) && previousKeyboardState.IsKeyUp(Keys.I))
            {
                _formation.addSoldier(new Targeteer(this, getMapOffset().X, getMapOffset().Y + PikeAndShotGame.SCREENHEIGHT * 0.5f, SIDE_PLAYER));
            }
            if (keyboardState.IsKeyDown(Keys.O) && previousKeyboardState.IsKeyUp(Keys.O))
            {
                _formation.addSoldier(new Brigand(this, getMapOffset().X, getMapOffset().Y + PikeAndShotGame.SCREENHEIGHT * 0.5f, SIDE_PLAYER));
            }
            if (keyboardState.IsKeyDown(Keys.C) && previousKeyboardState.IsKeyUp(Keys.C))
            {
                _formation.haltHorses();
            }
            if (keyboardState.IsKeyDown(Keys.V) && previousKeyboardState.IsKeyUp(Keys.V))
            {
                _formation.turnHorses();
            }
            if (keyboardState.IsKeyDown(Keys.A) && previousKeyboardState.IsKeyUp(Keys.A) || (gamePadState.IsButtonDown(Buttons.LeftShoulder) && previousGamePadState.IsButtonUp(Buttons.LeftShoulder)))
            {
                _formation.reduceWidth();
            }
            else if (keyboardState.IsKeyDown(Keys.S) && previousKeyboardState.IsKeyUp(Keys.S) || (gamePadState.IsButtonDown(Buttons.RightShoulder) && previousGamePadState.IsButtonUp(Buttons.RightShoulder)))
            {
                _formation.increaseWidth();
            }

            if ((keyboardState.IsKeyDown(Keys.OemQuestion) && previousKeyboardState.IsKeyUp(Keys.OemQuestion)) || (gamePadState.IsButtonDown(Buttons.Start) && previousGamePadState.IsButtonUp(Buttons.Start)))
            {
                writeFormation();
                _pattern.Clear();
                _formation = new Formation(this, 600, 200, 5, SIDE_ENEMY);
                _fileCount++;

            }
            // only when the keys being pressed changes, do we create a new part of the behavoural pattern
            else if (!gamePadState.Equals(previousGamePadState) || !keyboardState.Equals(previousKeyboardState))
            {
                addNextPatternAction();
            }

            previousKeyboardState = keyboardState;
            previousGamePadState = gamePadState;
        }
예제 #8
0
 public Subformation(Formation parent, BattleScreen screen, float x, float y, int side)
     : base(screen, x, y, 20, side)
 {
     _parent = parent;
 }