Exemplo n.º 1
0
        /// <summary>
        /// This draws the highscore and adds it as a child of the gameobject it is called from
        /// </summary>
        /// <param name="pSize">
        /// The pSize represents the size of the drawn highscorelist,
        /// With a value between 1 and 20.
        /// </param>
        public void DrawHighScore(float pSize, GameObject pParent)
        {
            if (pSize < 1) { pSize = 1; }
            if (pSize > 20) { pSize = 20; }

            Canvas highscorecv = new Canvas(1028, (int)pSize * 30);
            pParent.AddChild(highscorecv);

            Font font = new Font("Arial", pSize, FontStyle.Regular);
            Brush brush = new SolidBrush(Color.White);

            int placementValue = 0;
            for (int i = 9; i >= 0; i--)
            {
                placementValue++;
                PointF posI = new PointF(0, placementValue * pSize * 2);
                string message = _highScoreNames[i] + " " + _highScores[i];
                highscorecv.graphics.DrawString(message, font, brush, posI);
            }
        }
Exemplo n.º 2
0
        public Level(int level, int lives = 3)
            : base()
        {
            game.Add (this);
            _currentLevel = level;

            //set the background color
            Canvas canvas = new Canvas (game.width, game.height);
            canvas.graphics.FillRectangle (new SolidBrush (Color.FromArgb (125, 106, 148)), new Rectangle (0, 0, game.width, game.height));
            AddChild (canvas);

            //level lister to get the level names
            _levelList = new LevelLister ();

            //import the selected level
            _levelImporter = new LevelImporter (level);
            this.AddChild (_levelImporter);

            //create the player
            _player = new Player (lives);

            //render the tiles of the selected level
            _tileRenderer = new TileRenderer ();
            this.AddChild (_tileRenderer);
            _tileRenderer.GetTiles (_levelImporter, _player);
            Console.WriteLine ("Level Loaded");

            //add the player to the level
            this.AddChild (_player);
            Console.WriteLine ("Player Loaded");

            //add the scoreboard
            _hud = new HUD ();
            this.AddChild (_hud);
            Console.WriteLine ("HUD loaded");
        }
Exemplo n.º 3
0
Arquivo: Menu.cs Projeto: mbos14/GTFO
 private void drawBackGround()
 {
     Canvas menuBG = new Canvas("menubackground.png");
     menuBG.SetScaleXY(4, 4);
     AddChild(menuBG);
 }