Ejemplo n.º 1
0
        public Layer GameOverScreen(Player player, int time, Camera camera, int carrotPos)
        {
            Layer layer = NormalHud(player, time, camera);

            Vector2 pos = new Vector2()
            {
                X = camera.DrawRectangle.Width / 2 - pauseHud.Texture.Width / 2,
                Y = camera.DrawRectangle.Height / 2 - pauseHud.Texture.Height / 3
            };

            gameoverHud.Position = pos;
            layer.Sprites.Add(gameoverHud);
            WordSprite scorePart = WordAndNumberMaking.Instance.Number(player.Score, 1, WordAndNumberMaking.CharColor.white);

            scorePart.Position = new Vector2(pos.X + winHud.Texture.Width - (scorePart.SourceRectangles.Count * 12), pos.Y + 131);
            layer.Sprites.Add(scorePart);
            layer.Sprites.Add(SelectionArrow(pos, carrotPos));
            return(layer);
        }
Ejemplo n.º 2
0
        public Layer NormalHud(Player player, int time, Camera camera)
        {
            Layer layer = new Layer(camera)
            {
                Parallax = Vector2.Zero
            };

            ISet <ISprite> sprites = new HashSet <ISprite>();

            mainHud.Position = new Vector2(62, 1);
            sprites.Add(mainHud);
            WordSprite livesCount = WordAndNumberMaking.Instance.Number(player.Lives, 2, WordAndNumberMaking.CharColor.yellow);

            livesCount.Position = new Vector2(100, 2);
            sprites.Add(livesCount);
            for (int i = 0; i < player.Keys; i++)
            {
                ISprite keyHud = new Sprite(keyHudTexture)
                {
                    Position = new Vector2(175 + (keyHudTexture.Width + 2) * i, 1)
                };
                sprites.Add(keyHud);
            }

            WordSprite timeNum = WordAndNumberMaking.Instance.Number(time, 3, WordAndNumberMaking.CharColor.yellow);

            timeNum.Position = new Vector2(328, 17);
            sprites.Add(timeNum);
            WordSprite coinNum = WordAndNumberMaking.Instance.Number(player.Coins, 1, WordAndNumberMaking.CharColor.white);

            coinNum.Position = new Vector2(camera.DrawRectangle.Width - (coinNum.SourceRectangles.Count * 14) - 3, 2);
            sprites.Add(coinNum);
            WordSprite scoreNum = WordAndNumberMaking.Instance.Number(player.Score, 1, WordAndNumberMaking.CharColor.white);

            scoreNum.Position = new Vector2(camera.DrawRectangle.Width - (scoreNum.SourceRectangles.Count * 14) - 3, 18);
            sprites.Add(scoreNum);
            layer.Sprites = sprites;
            return(layer);
        }
Ejemplo n.º 3
0
        public Layer WinScreen(Player player, int time, Camera camera, int mult)
        {
            //add the normal hud to the game
            Layer layer = NormalHud(player, time, camera);

            Vector2 pos = new Vector2()
            {
                X = camera.DrawRectangle.Width / 2 - pauseHud.Texture.Width / 2,
                Y = camera.DrawRectangle.Height / 2 - pauseHud.Texture.Height / 3
            };

            winHud.Position = pos;
            layer.Sprites.Add(winHud);
            //add time and what it equals
            WordSprite timeNum = WordAndNumberMaking.Instance.Number(time, 3, WordAndNumberMaking.CharColor.white);

            timeNum.Position = new Vector2(pos.X + 20, pos.Y + 34);
            layer.Sprites.Add(timeNum);
            WordSprite scorePart = WordAndNumberMaking.Instance.Number(mult, 1, WordAndNumberMaking.CharColor.white);

            scorePart.Position = new Vector2(pos.X + winHud.Texture.Width - (scorePart.SourceRectangles.Count * 12), pos.Y + 34);
            layer.Sprites.Add(scorePart);
            return(layer);
        }