コード例 #1
0
ファイル: BattleScreen.cs プロジェクト: JamesEdSmith/gamedev
        public BattleScreen(PikeAndShotGame game)
        {
            _game = game;
            playerInPlay = true;

            //shot and clean up arrays
            _shots = new ArrayList(40);
            _deadThings = new ArrayList(40);
            _moreDeadThings = new ArrayList(2);
            _newThings = new ArrayList(40);
            _deadFormations = new ArrayList(20);

            //arrays for collisions
            _screenObjects = new ArrayList(40);
            _screenObjectsToAdd = new ArrayList(40);
            _screenColliders = new ArrayList(40);
            _screenAnimations = new ArrayList(40);
            _screenAnimationsToAdd = new ArrayList(40);
            _enemyFormationsToAdd = new ArrayList(3);

            _enemyFormations = new ArrayList(25);
            _looseSoldiers = new ArrayList(40);
            unlooseSoldiers = new ArrayList(5);

            previousKeyboardState = Keyboard.GetState();
            _elapsedTime = 0.0;

            _mapOffset = new Vector2(0f, 0f);
            _drawDots = false;
            _terrain = new ArrayList(20);

            _drawJobs = new ArrayList(255);
        }
コード例 #2
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;
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: JamesEdSmith/gamedev
        static void Main(string[] args)
        {
            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);

            using (PikeAndShotGame game = new PikeAndShotGame())
            {
                game.Run();
            }
        }
コード例 #4
0
ファイル: BattleScreen.cs プロジェクト: JamesEdSmith/gamedev
        public BattleScreen(PikeAndShotGame game)
        {
            _game = game;
            _active = false;

            //shot and clean up arrays
            _shots = new ArrayList(40);
            _deadThings = new ArrayList(40);
            _moreDeadThings = new ArrayList(2);
            _newThings = new ArrayList(40);
            _deadFormations = new ArrayList(20);

            //arrays for collisions
            _screenObjects = new ArrayList(40);
            _screenObjectsToAdd = new ArrayList(40);
            _screenColliders = new ArrayList(40);
            _screenNonColliders = new ArrayList(20);
            _screenAnimations = new ArrayList(40);
            _screenAnimationsToAdd = new ArrayList(40);
            _enemyFormationsToAdd = new ArrayList(3);

            _enemyFormations = new ArrayList(25);
            _looseSoldiers = new ArrayList(40);
            unlooseSoldiers = new ArrayList(5);

            previousKeyboardState = Keyboard.GetState();
            _elapsedTime = 0.0;

            _mapOffset = new Vector2(0f, 0f);
            _drawDots = false;
            _terrain = new ArrayList(20);

            for (int i = 0; i < 100; i++)
            {
                _terrain.Add(new Terrain(this, PikeAndShotGame.ROAD_TERRAIN[PikeAndShotGame.random.Next(7)], SIDE_PLAYER, PikeAndShotGame.random.Next(PikeAndShotGame.SCREENWIDTH), PikeAndShotGame.random.Next(PikeAndShotGame.SCREENHEIGHT)));
            }

            _drawJobs = new ArrayList(255);
        }
コード例 #5
0
ファイル: LevelScreen.cs プロジェクト: JamesEdSmith/gamedev
        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
 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;
 }