Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- HealthBar(40);
- Console.SetCursorPosition(45, 11);
- Console.Write("Введите количество хп в % максимальное значение 100%: ");
- int playerhp = Convert.ToInt32(Console.ReadLine());
- HealthBar(playerhp);
- Console.ReadLine();
- }
- static void HealthBar(int persent)
- {
- int maxhp = 100;
- Console.SetCursorPosition(45, 10);
- if (persent <= maxhp)
- {
- Console.Write("HP: [");
- persent /= 10;
- for (int i = 0; i < persent; i++)
- {
- Console.Write('#');
- }
- for (int i = persent; i < 10; i++)
- {
- Console.Write('_');
- }
- Console.Write(']');
- }
- else
- {
- Console.Clear();
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine("Вы ввели слишком большое количество здоровья");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement