Exemplo n.º 1
0
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     // TODO: Add your initialization logic here
     map = new GameMap();
     enemy = new Enemy();
     base.Initialize();
 }
Exemplo n.º 2
0
        //initialise and start new game
        private void startNewSinglePlayerGame()
        {
            //setup grid landscape
            loadGridTiles();

            objects = new List<GameObject>();//keeps track of all objects in game
            enemyObjects = new List<EnemyObject>();//keeps track of all enemy objects
            currentMenuOption = 1;
            collisionDetector = new CollisionDetection();
            bombsLayed1 = new List<BombObject>();
            bombCount1 = 0;

            //keep track of all the scores
            player1Score = 0;
            player2Score = 0;
            highestEnemyScore = 0;

            //setup time variables
            startTime = System.Environment.TickCount;
            totalTime = 60;
            pausedTime = 0;
            elapsedPauseTime = 0;
            gamePaused = false;

            //initiailse map
            map = new GameMap(screenWidth, screenHeight, gridWidth, gridHeight, gridTileDimensions);
            map.initialiseMap(destructableTexture,indestructableTexture);

            //create player object positioned at the bottom, middle of screen
            //player1
            player1Obj = new Player(playerTexture, 4, 4, playerTexture.Width/4, (gridHeight/2)*48, 400);
            player1Obj.playerID = "Player1";
            player1Alive = true;
            objects.Add(player1Obj);
            player2Alive = false;
            //enemies
            for (int i = 0; i < 5; i++)
            {
                EnemyObject testEnemy = new EnemyObject(playerTexture, 4, 4, (screenWidth - (playerTexture.Width / 4)) - 30 - i*48,
                                (gridHeight / 2)*48, 200);
                testEnemy.playerID = "Enemy"+(i+1);
                objects.Add(testEnemy);
                enemyObjects.Add(testEnemy);
            }
        }