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 CSLight
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Введите координату x:");
- int posX = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Введите координату y:");
- int posY = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Введите заполненность бара (от 0 до 10):");
- int fullNess = Convert.ToInt32(Console.ReadLine());
- if (fullNess < 0 || fullNess > 10)
- {
- DrawHealthBar(posX, posY);
- }
- else
- {
- DrawHealthBar(posX, posY, fullNess);
- }
- Console.ReadKey();
- }
- static void DrawHealthBar(int posX, int posY, int fullNess = 10)
- {
- Console.SetCursorPosition(posX, posY);
- Console.Write("[");
- int maxHealth = 10;
- for (int x = 0; x < fullNess; x++)
- {
- Console.Write("#");
- }
- for (int x = 0; x < maxHealth - fullNess; x++)
- {
- Console.Write("_");
- }
- Console.Write("]");
- }
- }
- }
Add Comment
Please, Sign In to add comment