Пример #1
0
        //Add all text.
        public ScoreManager(HighScoreClass _highScores, ContentManager content)
        {
            places = new List<TextLine>();
            scores = new List<TextLine>();
            names = new List<TextLine>();
            highScores = _highScores;

            input = new TextLine("Font", "Input name: " + name + "|", Color.White, new Vector2(0, 0));

            places.Add(new TextLine("Font", "1st", Color.White, new Vector2(textSpaceX, textSpaceY * 1)));
            places.Add(new TextLine("Font", "2nd", Color.White, new Vector2(textSpaceX, textSpaceY * 2)));
            places.Add(new TextLine("Font", "3rd", Color.White, new Vector2(textSpaceX, textSpaceY * 3)));

            for (int i = 0; i < 10; i++)
            {
                if (i > 2)
                {
                    places.Add(new TextLine("Font", (i + 1).ToString() + "th", Color.White, new Vector2(50, textSpaceY + textSpaceY * i)));
                }
                scores.Add(new TextLine("Font", "", Color.White, new Vector2(textSpaceX * 3, textSpaceY + textSpaceY * i)));
                names.Add(new TextLine("Font", "", Color.White, new Vector2(textSpaceX * 6, textSpaceY + textSpaceY * i)));
            }

            //Get the score from the files.
            GetScore();
        }
Пример #2
0
        //Load everything and set position.
        public void LoadContent(ContentManager content)
        {
            cursor = new GraphicalObject("Player", new Vector2(190, 0));

            play = new TextLine("Font", "Play Game", Color.White, new Vector2(240, 200));
            score = new TextLine("Font", "High Scores", Color.White, new Vector2(240, 250));
            end = new TextLine("Font", "End Game", Color.White, new Vector2(240, 300));

            title = new GraphicalObject("Title", new Vector2(0, 0));
            title.X = width / 2 - title.width / 2;
            title.Y = 25;
        }
Пример #3
0
        //Reset everything for a new round of Space Invaders.
        public void Reset()
        {
            Main.currentScore = 0;
            overallDifficulty = 0;
            levelDifficulty = 0;

            invaders = new List<Enemy>();
            invaderPosition = new List<EnemyPosition>();
            lasers = new List<Laser>();
            invaderDestroyed = new List<GraphicalObject>();
            blockFormations = new List<BlockFormation>();
            lifeMarkers = new List<GraphicalObject>();

            player = new Player("Player", new Vector2(width / 2, height - 40));
            player.GetLifeTexture();

            EnemyPosition.overallPosition = new Vector2(0, 0);

            pointText = new TextLine("Font", Main.currentScore.ToString(), Color.White, new Vector2(10, 10));

            shootNext = rand.Next(800, 2000);
            lifeMarkers.Add(new GraphicalObject("Player", new Vector2(width, 0)));
            lifeMarkers.Add(new GraphicalObject("Player", new Vector2(width, 0)));

            int blockPoint = width / 5;

            for (int i = 0; i < 4; i++)
            {
                blockFormations.Add(new BlockFormation());
                blockFormations[i].LoadContent(content, blockPoint + blockPoint * i, height);
            }

            UFO.Reset();

            NewWave(content);
        }