Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace _4_2
- {
- class Program
- {
- static void Main(string[] args)
- {
- int health = 2;
- HealthBar(health);
- }
- static void HealthBar (int health, int posX = 0, int posY = 0, char barChar = '#')
- {
- char[] healthBar = { '[', '_', '_', '_', '_', '_', '_', '_', '_', '_', '_', ']' };
- for (int i = 0; i < health / 10 && i != 10; i++)
- healthBar[i + 1] = barChar;
- Console.SetCursorPosition(posX, posY);
- for (int i = 0; i < healthBar.Length; i++)
- Console.Write(healthBar[i]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement