Advertisement
Seeptim

Lesson_4_2

Aug 15th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.27 KB | None | 0 0
  1. using System;
  2. namespace Lesson_4_2
  3. {
  4.     class Program
  5.     {
  6.         static void Main(string[] args)
  7.         {
  8.             Console.WriteLine("После схватки с врагом у вас осталось");
  9.             int minValue = 40;
  10.             int maxValue = 100;
  11.             ConsoleColor color = ConsoleColor.Black;
  12.             Console.WriteLine("Рисуем Полоску здоровья!");
  13.             HealtBar(minValue, maxValue, color);
  14.             Console.ReadKey();
  15.         }
  16.         static void HealtBar(int minValue, int maxValue, ConsoleColor color)
  17.         {
  18.             ConsoleColor defaultColor = Console.BackgroundColor;
  19.             string bar = "";
  20.             for (int i = 0; i < minValue; i++)
  21.             {
  22.                 bar += "#";
  23.             }
  24.             Console.SetCursorPosition(0, 2);
  25.             Console.BackgroundColor = defaultColor;
  26.             Console.Write("[");
  27.             Console.BackgroundColor = color;
  28.             Console.Write(bar);
  29.  
  30.             bar = "";
  31.             for (int i = minValue; i < maxValue; i++)
  32.             {
  33.                 bar += "_";
  34.             }
  35.             Console.BackgroundColor = defaultColor;
  36.             Console.Write(bar + "]");
  37.             Console.WriteLine();
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement