Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Collections.Specialized;
- using System.Diagnostics.CodeAnalysis;
- using System.Dynamic;
- using System.Globalization;
- using System.Linq;
- using System.Runtime.Serialization;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- namespace CSLight
- {
- class Program
- {
- static void Main(string[] args)
- {
- int health = 45322, maxHealth = 52348;
- int mana = 195, maxMana = 321;
- DrawBAr(health, maxHealth, ConsoleColor.Red, 0);
- DrawBAr(mana, maxMana, ConsoleColor.Blue, 1);
- }
- static void DrawBAr(int value, int maxValue, ConsoleColor color, int position)
- {
- int percent = (((value * 100) / maxValue) / 10);
- ConsoleColor defaultColor = Console.BackgroundColor;
- string bar = "";
- for(int i = 0; i < percent; i++)
- {
- bar += '#';
- }
- Console.SetCursorPosition(0, position);
- Console.Write('[');
- Console.BackgroundColor = color;
- Console.Write(bar);
- Console.BackgroundColor = defaultColor;
- bar = "";
- for(int i = 0; i < (10- percent); i++)
- {
- bar += '_';
- }
- Console.Write(bar + ']');
- }
- }
- }
Add Comment
Please, Sign In to add comment