Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.71 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Lesson_4._2
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             DrowHealthBar();
  14.             DrowHealthBar(1,1,40);
  15.             DrowHealthBar(2,2,50);
  16.             DrowHealthBar(3,3,10);
  17.  
  18.             Console.Read();
  19.         }
  20.         static void DrowHealthBar(int x = 0, int y = 0, int health = 100)
  21.         {
  22.             Console.SetCursorPosition(x, y);
  23.  
  24.             int full = 10;
  25.             int fill = health / full;
  26.  
  27.             Console.Write('[' + new String('#', fill) + new String('_', full - fill) + ']');
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement