Exemplo n.º 1
0
        public static bool ContinueGame(ConsoleGraphics graphics, GameEngine engine)
        {
            var scoreCounter = engine.GetFirstObjectByType <ScoreCounter>();

            graphics.DrawImagePart(graphics.LoadImage("Images/snake-gameover.jpg"), 0, 0, graphics.ClientWidth, graphics.ClientHeight, 0, 0);
            graphics.DrawString($"Current score:{scoreCounter.Score}", Settings.FontName, Settings.WhiteColor, 320, 450, 36);
            graphics.DrawString($"Best score:{scoreCounter.BestScore}", Settings.FontName, Settings.WhiteColor, 350, 520, 36);
            graphics.FlipPages();

            while (true)
            {
                if (Input.IsKeyDown(Keys.SPACE))
                {
                    return(true);
                }

                if (Input.IsKeyDown(Keys.ESCAPE))
                {
                    return(false);
                }
            }
        }
Exemplo n.º 2
0
 public override void Render(ConsoleGraphics graphics)
 {
     graphics.DrawImagePart(image, 160, 200, H, W, X, Y);
 }
Exemplo n.º 3
0
        public override void Render(ConsoleGraphics graphics)
        {
            switch (Type)
            {
            case SnakePartType.Tail:
                if (Direction == MoveDirection.Down)
                {
                    graphics.DrawImagePart(_image, 32, 16, _size, _size, Position.X, Position.Y);
                }
                else if (Direction == MoveDirection.Up)
                {
                    graphics.DrawImagePart(_image, 0, 16, _size, _size, Position.X, Position.Y);
                }
                else if (Direction == MoveDirection.Right)
                {
                    graphics.DrawImagePart(_image, 16, 16, _size, _size, Position.X, Position.Y);
                }
                else
                {
                    graphics.DrawImagePart(_image, 48, 16, _size, _size, Position.X, Position.Y);
                }
                break;

            case SnakePartType.Body:
                if (Direction == MoveDirection.Down || Direction == MoveDirection.Up)
                {
                    graphics.DrawImagePart(_image, 0, 48, _size, _size, Position.X, Position.Y);
                }
                else
                {
                    graphics.DrawImagePart(_image, 16, 48, _size, _size, Position.X, Position.Y);
                }
                break;

            case SnakePartType.BodyLeftDownOrUpRight:
                graphics.DrawImagePart(_image, 16, 32, _size, _size, Position.X, Position.Y);
                break;

            case SnakePartType.BodyLeftUpOrDownRight:
                graphics.DrawImagePart(_image, 0, 32, _size, _size, Position.X, Position.Y);
                break;

            case SnakePartType.BodyRightDownOrUpLeft:
                graphics.DrawImagePart(_image, 32, 32, _size, _size, Position.X, Position.Y);
                break;

            case SnakePartType.BodyRightUpOrDownLeft:
                graphics.DrawImagePart(_image, 48, 32, _size, _size, Position.X, Position.Y);
                break;

            case SnakePartType.Head:
                if (Direction == MoveDirection.Down)
                {
                    graphics.DrawImagePart(_image, 32, 0, _size, _size, Position.X, Position.Y);
                }
                else if (Direction == MoveDirection.Up)
                {
                    graphics.DrawImagePart(_image, 0, 0, _size, _size, Position.X, Position.Y);
                }
                else if (Direction == MoveDirection.Right)
                {
                    graphics.DrawImagePart(_image, 16, 0, _size, _size, Position.X, Position.Y);
                }
                else
                {
                    graphics.DrawImagePart(_image, 48, 0, _size, _size, Position.X, Position.Y);
                }
                break;
            }
        }
Exemplo n.º 4
0
 public override void Render(ConsoleGraphics graphics)
 {
     graphics.DrawImagePart(Image, 0, 280, W, H, X, Y);
 }
Exemplo n.º 5
0
 public override void Render(ConsoleGraphics graphics)
 {
     graphics.DrawImagePart(Image, OffsetX, OffsetY, W, H, X, Y);
 }
Exemplo n.º 6
0
 public override void Render(ConsoleGraphics graphics)
 {
     graphics.DrawImagePart(_image, 32, 48, 16, 16, Position.X, Position.Y);
 }
Exemplo n.º 7
0
 public virtual void Render(ConsoleGraphics graphics)
 {
     graphics.DrawImagePart(Image, OffsetX, OffsetY, W, H, X, Y);
 }
Exemplo n.º 8
0
 public static void Greeting(ConsoleGraphics graphics)
 {
     graphics.DrawImagePart(graphics.LoadImage("Images/snake-start.jpg"), 0, 0, graphics.ClientWidth, graphics.ClientHeight, 0, 0);
     graphics.FlipPages();
     Console.ReadLine();
 }