Exemplo n.º 1
0
        public void Draw(SpriteBatch theSpriteBatch, AwesomeSquare player)
        {
            //Depending on the players score the map gets darker when the enemies become faster and more difficult to kill

            if (player.score >= 0 && player.score < 3)
            {
                theSpriteBatch.Draw(mSpriteTexture, position, Color.White);
            }


            else if (player.score >= 3 && player.score < 5)
            {
                theSpriteBatch.Draw(mSpriteTexture, position, Color.LightSalmon);
            }
            else if (player.score >= 5 && player.score < 7)
            {
                theSpriteBatch.Draw(mSpriteTexture, position, Color.Salmon);
            }
            else if (player.score >= 7 && player.score < 9)
            {
                theSpriteBatch.Draw(mSpriteTexture, position, Color.OrangeRed);
            }
            else if (player.score >= 9)
            {
                theSpriteBatch.Draw(mSpriteTexture, position, Color.Red);
            }
        }
Exemplo n.º 2
0
 public void BoundaryChecking(WorldSquare[,] maze, AwesomeSquare player)
 {
     if (maze[row, col].containsSquare == true)
     {
         alive = false;
         player.score++;
     }
 }
Exemplo n.º 3
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
            // WorldSquare[,] maze = new WorldSquare[MaxRows, MaxCols];

            random = new Random();

            player = new AwesomeSquare();
            for (int i = 0; i < maxEnemies; i++)
            {
                enemies[i] = new EvilSquares(random, maze);
            }


            //Initialise the map array
            for (int row = 0; row < MaxRows; row++)
            {
                for (int col = 0; col < MaxCols; col++)
                {
                    maze[row, col] = new WorldSquare(x, y);
                    x = x + SquareSize;
                }
                x = 0;
                y = y + SquareSize;
            }


            //Grid of the map
            int[,] screen = { { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 },
                              { 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1 },
                              { 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1 },
                              { 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1 },
                              { 1, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0, 1 },
                              { 1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1 },
                              { 1, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1 },
                              { 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1 },
                              { 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0, 1 },
                              { 1, 0, 1, 0, 1, 0, 0, 0, 1, 1, 0, 1 },
                              { 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1 },
                              { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } };



            for (int col = 0; col < MaxCols; col++)
            {
                for (int row = 0; row < MaxRows; row++)
                {
                    if (screen[row, col] == 1)
                    {
                        maze[row, col].containsSquare = true;
                    }
                }
            }



            base.Initialize();
        }