Advertisement
Vlad_Savitskiy

Properties

Apr 19th, 2020
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.87 KB | None | 0 0
  1. using System;
  2.  
  3. namespace CSLight
  4. {
  5.     class Player
  6.     {
  7.         public int X { get; }
  8.         public int Y { get; }
  9.         public char Symbol { get; }
  10.  
  11.         public Player(int x, int y, char symbol)
  12.         {
  13.             X = x;
  14.             Y = y;
  15.             Symbol = symbol;
  16.         }
  17.     }
  18.  
  19.     class Drawer
  20.     {
  21.         public static void Draw(int x, int y, string line)
  22.         {
  23.             Console.SetCursorPosition(y, x);
  24.             Console.Write(line);
  25.         }
  26.  
  27.         public static void DrawLine(int x, int y, string line)
  28.         {
  29.             Console.SetCursorPosition(y, x);
  30.             Console.WriteLine(line);
  31.         }
  32.     }
  33.  
  34.     class Program
  35.     {
  36.         static void Main()
  37.         {
  38.             Player player = new Player(3, 3, '@');
  39.  
  40.             Drawer.Draw(player.X, player.Y, player.Symbol.ToString());
  41.         }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement