Esempio n. 1
0
        public MenuScreen(ContentManager contentManager)
        {
            tilesSprite = contentManager.Load <Texture2D>("minitiles");

            for (int row = 0; row < menuScreenTilesContent.GetLength(0); row++)
            {
                for (int col = 0; col < menuScreenTilesContent.GetLength(1); col++)
                {
                    tiles.Add(new Tile(tilesSprite, 1, 2, menuScreenTilesContent[row, col], col, row, false));
                }
            }

            sprite          = contentManager.Load <Texture2D>("playertank1");
            sourceRectangle = new Rectangle(GameConstants.TILE_WIDTH * 6, 0, GameConstants.TILE_WIDTH, GameConstants.TILE_WIDTH);
            drawRectangle   = new Rectangle(GameConstants.TILE_WIDTH * 4, GameConstants.TILE_WIDTH * 8 - GameConstants.SMALL_TILE_WIDTH / 2,
                                            GameConstants.TILE_WIDTH, GameConstants.TILE_WIDTH);

            text.Add(new StringSprite(contentManager, "I-", Color.White,
                                      GameConstants.TILE_WIDTH, GameConstants.TILE_WIDTH));

            player1recordSprite = new NumberSprite(contentManager, player1record, TextDirection.Right, Color.White,
                                                   GameConstants.TILE_WIDTH * 5, GameConstants.TILE_WIDTH);
            hiRecordSprite = new NumberSprite(contentManager, hiRecord, TextDirection.Right, Color.White,
                                              GameConstants.TILE_WIDTH * 10, GameConstants.TILE_WIDTH);

            text.Add(new StringSprite(contentManager, "HI-", Color.White,
                                      GameConstants.TILE_WIDTH * 5 + GameConstants.SMALL_TILE_WIDTH, GameConstants.TILE_WIDTH));

            text.Add(new StringSprite(contentManager, "1 PLAYER", Color.White,
                                      GameConstants.TILE_WIDTH * 5 + GameConstants.SMALL_TILE_WIDTH, GameConstants.TILE_WIDTH * 8));
        }
Esempio n. 2
0
        public ScoreField(ContentManager contentManager, GraphicsDevice graphicsDevice, int currentLevel)
        {
            scoreField = new Texture2D(graphicsDevice, 1, 1, false, SurfaceFormat.Color);

            scoreField.SetData <Color>(new Color[] { new Color(99, 99, 99) });

            scoreFieldDrawRectangle = new Rectangle(GameConstants.FIELD_WIDTH, 0,
                                                    GameConstants.WINDOW_WIDTH - GameConstants.FIELD_WIDTH, GameConstants.WINDOW_HEIGHT);

            scoreSprite = contentManager.Load <Texture2D>("scoreSprite");
            playerOneLivesDrawRectangle = new Rectangle(
                GameConstants.FIELD_WIDTH + GameConstants.SMALL_TILE_WIDTH,
                GameConstants.TILE_WIDTH * 7 + GameConstants.SMALL_TILE_WIDTH,
                GameConstants.TILE_WIDTH, GameConstants.TILE_WIDTH);
            playerOneLivesSourceRectangle = new Rectangle(
                GameConstants.TILE_WIDTH * 5, 0,
                GameConstants.TILE_WIDTH, GameConstants.TILE_WIDTH);

            playerOneLivesNumberSprite = new NumberSprite(contentManager, GameConstants.PLAYER_ONE_LIVES_COUNT, TextDirection.Right, Color.Black,
                                                          GameConstants.FIELD_WIDTH + GameConstants.TILE_WIDTH + GameConstants.SMALL_TILE_WIDTH, GameConstants.TILE_WIDTH * 8);

            stageDrawRectangle = new Rectangle(
                GameConstants.FIELD_WIDTH + GameConstants.SMALL_TILE_WIDTH,
                GameConstants.TILE_WIDTH * 10 + GameConstants.SMALL_TILE_WIDTH,
                GameConstants.TILE_WIDTH, GameConstants.TILE_WIDTH);
            stageSourceRectangle = new Rectangle(
                GameConstants.TILE_WIDTH * 6, 0,
                GameConstants.TILE_WIDTH, GameConstants.TILE_WIDTH);

            stageNumberSprite = new NumberSprite(contentManager, currentLevel, TextDirection.Right, Color.Black,
                                                 GameConstants.FIELD_WIDTH + GameConstants.TILE_WIDTH + GameConstants.SMALL_TILE_WIDTH,
                                                 GameConstants.TILE_WIDTH * 11 + GameConstants.SMALL_TILE_WIDTH);
        }
Esempio n. 3
0
        public TankScore(ContentManager contentManager, double yPosition, int tankType)
        {
            this.tankType    = tankType;
            scoreCountSprite = new NumberSprite(contentManager, 0, TextDirection.Right, Color.White,
                                                GameConstants.TILE_WIDTH * 3 + GameConstants.SMALL_TILE_WIDTH, (int)(GameConstants.TILE_WIDTH * yPosition));

            tankCountSprite = new NumberSprite(contentManager, 0, TextDirection.Right, Color.White,
                                               GameConstants.TILE_WIDTH * 7, (int)(GameConstants.TILE_WIDTH * yPosition));
        }
Esempio n. 4
0
        public NextLevel(ContentManager contentManager, GraphicsDevice graphicsDevice, int currentLevel)
        {
            scoreField = new Texture2D(graphicsDevice, 1, 1, false, SurfaceFormat.Color);

            scoreField.SetData <Color>(new Color[] { new Color(99, 99, 99) });

            scoreFieldDrawRectangle = new Rectangle(0, 0,
                                                    GameConstants.WINDOW_WIDTH, 0);

            scoreFieldDrawRectangle2 = new Rectangle(0, GameConstants.WINDOW_HEIGHT,
                                                     GameConstants.WINDOW_WIDTH, 0);

            stageText = new StringSprite(contentManager, "STAGE", Color.Black,
                                         GameConstants.TILE_WIDTH * 5 + GameConstants.SMALL_TILE_WIDTH, GameConstants.TILE_WIDTH * 6);

            stageNumberSprite = new NumberSprite(contentManager, currentLevel, TextDirection.Right, Color.Black,
                                                 GameConstants.TILE_WIDTH * 9 + GameConstants.SMALL_TILE_WIDTH, GameConstants.TILE_WIDTH * 6);
        }
Esempio n. 5
0
        public ScoreScreen(ContentManager contentManager, int currentLevel, SoundBank soundBank)
        {
            scoreSprite    = contentManager.Load <Texture2D>("scoreSprite");
            tankSprite     = contentManager.Load <Texture2D>("enemytank1");
            this.soundBank = soundBank;

            text.Add(new StringSprite(contentManager, "HI-SCORE", Color.Red,
                                      GameConstants.TILE_WIDTH * 4, GameConstants.TILE_WIDTH));
            text.Add(new StringSprite(contentManager, "STAGE", Color.White,
                                      GameConstants.TILE_WIDTH * 6, GameConstants.TILE_WIDTH * 2));
            text.Add(new StringSprite(contentManager, "I-PLAYER", Color.Red,
                                      GameConstants.TILE_WIDTH + GameConstants.SMALL_TILE_WIDTH, GameConstants.TILE_WIDTH * 3));

            text.Add(new StringSprite(contentManager, "PTS", Color.White,
                                      GameConstants.TILE_WIDTH * 4, (int)(GameConstants.TILE_WIDTH * scoreYposition[0])));
            text.Add(new StringSprite(contentManager, "PTS", Color.White,
                                      GameConstants.TILE_WIDTH * 4, (int)(GameConstants.TILE_WIDTH * scoreYposition[1])));
            text.Add(new StringSprite(contentManager, "PTS", Color.White,
                                      GameConstants.TILE_WIDTH * 4, (int)(GameConstants.TILE_WIDTH * scoreYposition[2])));
            text.Add(new StringSprite(contentManager, "PTS", Color.White,
                                      GameConstants.TILE_WIDTH * 4, (int)(GameConstants.TILE_WIDTH * scoreYposition[3])));
            text.Add(new StringSprite(contentManager, "TOTAL", Color.White,
                                      GameConstants.TILE_WIDTH * 3, GameConstants.TILE_WIDTH * 11));

            stageNumberSprite = new NumberSprite(contentManager, currentLevel, TextDirection.Right, Color.White,
                                                 GameConstants.TILE_WIDTH * 10, GameConstants.TILE_WIDTH * 2);

            playerScoreSprite = new NumberSprite(contentManager, playerScore, TextDirection.Right, Color.Orange,
                                                 GameConstants.TILE_WIDTH * 5 + GameConstants.SMALL_TILE_WIDTH, GameConstants.TILE_WIDTH * 4);

            tankScores.Add(0, new TankScore(contentManager, scoreYposition[0], 0));
            tankScores.Add(1, new TankScore(contentManager, scoreYposition[1], 1));
            tankScores.Add(2, new TankScore(contentManager, scoreYposition[2], 2));
            tankScores.Add(3, new TankScore(contentManager, scoreYposition[3], 3));

            totalSprite = new NumberSprite(contentManager, 0, TextDirection.Right, Color.White,
                                           GameConstants.TILE_WIDTH * 7, GameConstants.TILE_WIDTH * 11);

            text.Add(new StringSprite(contentManager, "<", Color.White,
                                      GameConstants.TILE_WIDTH * 7, (int)(GameConstants.TILE_WIDTH * scoreYposition[0])));
            text.Add(new StringSprite(contentManager, "<", Color.White,
                                      GameConstants.TILE_WIDTH * 7, (int)(GameConstants.TILE_WIDTH * scoreYposition[1])));
            text.Add(new StringSprite(contentManager, "<", Color.White,
                                      GameConstants.TILE_WIDTH * 7, (int)(GameConstants.TILE_WIDTH * scoreYposition[2])));
            text.Add(new StringSprite(contentManager, "<", Color.White,
                                      GameConstants.TILE_WIDTH * 7, (int)(GameConstants.TILE_WIDTH * scoreYposition[3])));

            tank0drawRectangle = new Rectangle(
                GameConstants.TILE_WIDTH * 7 + GameConstants.SMALL_TILE_WIDTH, (int)(GameConstants.TILE_WIDTH * scoreYposition[0] - GameConstants.SMALL_TILE_WIDTH / 2),
                GameConstants.TILE_WIDTH, GameConstants.TILE_WIDTH);
            tank0SourceRectangle = new Rectangle(0, GameConstants.TILE_WIDTH * 4,
                                                 GameConstants.TILE_WIDTH, GameConstants.TILE_WIDTH);
            tank1drawRectangle = new Rectangle(
                GameConstants.TILE_WIDTH * 7 + GameConstants.SMALL_TILE_WIDTH, (int)(GameConstants.TILE_WIDTH * scoreYposition[1] - GameConstants.SMALL_TILE_WIDTH / 2),
                GameConstants.TILE_WIDTH, GameConstants.TILE_WIDTH);
            tank1SourceRectangle = new Rectangle(0, GameConstants.TILE_WIDTH * 5,
                                                 GameConstants.TILE_WIDTH, GameConstants.TILE_WIDTH);
            tank2drawRectangle = new Rectangle(
                GameConstants.TILE_WIDTH * 7 + GameConstants.SMALL_TILE_WIDTH, (int)(GameConstants.TILE_WIDTH * scoreYposition[2] - GameConstants.SMALL_TILE_WIDTH / 2),
                GameConstants.TILE_WIDTH, GameConstants.TILE_WIDTH);
            tank2SourceRectangle = new Rectangle(0, GameConstants.TILE_WIDTH * 6,
                                                 GameConstants.TILE_WIDTH, GameConstants.TILE_WIDTH);
            tank3drawRectangle = new Rectangle(
                GameConstants.TILE_WIDTH * 7 + GameConstants.SMALL_TILE_WIDTH, (int)(GameConstants.TILE_WIDTH * scoreYposition[3] - GameConstants.SMALL_TILE_WIDTH / 2),
                GameConstants.TILE_WIDTH, GameConstants.TILE_WIDTH);
            tank3SourceRectangle = new Rectangle(0, GameConstants.TILE_WIDTH * 7,
                                                 GameConstants.TILE_WIDTH, GameConstants.TILE_WIDTH);
        }