コード例 #1
0
ファイル: Program.cs プロジェクト: Kaidstor/SpaceInviders
        static void Initialize(Engine engine)
        {
            int startRow      = 2;
            int startCol      = 2;
            int endCol        = WorldCols - 2;
            int alienStartRow = startRow;

            for (int i = startCol + 4; i < endCol - 10; i++)
            {
                if (i == startCol + 15)
                {
                    alienStartRow++;
                }

                if (i == startCol + 20)
                {
                    alienStartRow--;
                }

                AlienShip alien = new AlienShip(new MatrixPosition(alienStartRow, i), new MatrixPosition(0, 1));
                engine.AddObject(alien);
            }

            PlayerShip player = new PlayerShip(new MatrixPosition(WorldRows - 2, WorldCols / 2));

            engine.AddObject(player);
        }
コード例 #2
0
        static void Initialize(Engine engine)
        {
            int startRow      = 2;
            int startCol      = 2;
            int endCol        = WorldCols - 10;
            int alienStartRow = startRow;

            //for (int i = startCol + 4; i < endCol - 10; i++)
            //{
            //    if (i == startCol + 15)
            //    {
            //        alienStartRow++;
            //    }

            //    if (i == startCol + 20)
            //    {
            //        alienStartRow--;
            //    }

            //    AlienShip alien = new AlienShip(new MatrixPosition(alienStartRow, i), new MatrixPosition(0, 1));
            //    engine.AddObject(alien);
            //}

            for (int i = startCol; i < endCol; i++)
            {
                AlienShip alien     = new AlienShip(new MatrixPosition(alienStartRow, i), new MatrixPosition(0, 1));
                HiveShip  hiveAlien = new HiveShip(new MatrixPosition(alienStartRow + 1, i), new MatrixPosition(0, 1));

                engine.AddObject(alien);
                engine.AddObject(hiveAlien);
            }

            PlayerShip player = PlayerShip.Instance(new MatrixPosition(WorldRows - 2, WorldCols / 2));

            engine.AddObject(player);
        }