Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp13
- {
- class Program
- {
- static void Main(string[] args)
- {
- int x, y,healthPercents;
- Console.Write("Введите значение x:");
- x = Convert.ToInt32(Console.ReadLine());
- Console.Write("Введите значение y:");
- y = Convert.ToInt32(Console.ReadLine());
- Console.Write("Введите количество здоровья в процентах:");
- healthPercents = Convert.ToInt32(Console.ReadLine());
- Console.Clear();
- drowHealthBar(x,y,healthPercents);
- }
- static void drowHealthBar(int x1,int y1, int healthPercents1)
- {
- int max = 10;
- string health = "";
- ConsoleColor defaultColor = Console.BackgroundColor;
- for (int i = 0; i < healthPercents1; i++)
- {
- health += ' ';
- }
- Console.SetCursorPosition(x1, y1);
- Console.Write('[');
- Console.BackgroundColor = ConsoleColor.DarkRed;
- Console.Write(health);
- health = "";
- Console.BackgroundColor = default;
- for (int i = healthPercents1; i < max; i++)
- {
- health += ' ';
- }
- Console.Write(health + ']');
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement