Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Lesson_4_2
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("После схватки с врагом у вас осталось");
- int minValue = 40;
- int maxValue = 100;
- ConsoleColor color = ConsoleColor.Black;
- Console.WriteLine("Рисуем Полоску здоровья!");
- HealtBar(minValue, maxValue, color);
- Console.ReadKey();
- }
- static void HealtBar(int minValue, int maxValue, ConsoleColor color)
- {
- ConsoleColor defaultColor = Console.BackgroundColor;
- string bar = "";
- for (int i = 0; i < minValue; i++)
- {
- bar += "#";
- }
- Console.SetCursorPosition(0, 2);
- Console.BackgroundColor = defaultColor;
- Console.Write("[");
- Console.BackgroundColor = color;
- Console.Write(bar);
- bar = "";
- for (int i = minValue; i < maxValue; i++)
- {
- bar += "_";
- }
- Console.BackgroundColor = defaultColor;
- Console.Write(bar + "]");
- Console.WriteLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement