Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace homework
- {
- class Program
- {
- static void setHealthBar(int maxValue = 10, int health=4, int positionX=10, int positionY=10, char charSign='#')
- {
- Console.SetCursorPosition(positionX, positionY);
- string str = "[";
- for (int i = 0; i < maxValue; i++) if (i < health) str += charSign;
- else str += "_";
- str += "]\n";
- Console.Write(str);
- }
- static void Main(string[] args)
- {
- Console.WriteLine("Вводить значения? Y/N");
- if (Console.ReadLine() == "Y")
- {
- int maxValue, health, posX, posY;
- char charSign;
- Console.WriteLine("Максимальное значение здоровья: ");
- maxValue = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Значение здоровья: ");
- health = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Position X = ");
- posX = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Position Y = ");
- posY = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Значек : ");
- charSign = Console.ReadKey().KeyChar;
- setHealthBar(maxValue, health, posX, posY, charSign);
- }
- else setHealthBar();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement