Advertisement
Rodunskiy

Untitled

Jul 18th, 2023
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.76 KB | None | 0 0
  1. class Program
  2. {
  3.     static void Main(string[] args)
  4.     {
  5.         Renderer renderer = new Renderer();
  6.         Player player = new Player(1,1,'@');
  7.  
  8.         renderer.DrawPlayer(player);
  9.  
  10.         Console.WriteLine();
  11.     }
  12. }
  13.  
  14. class Player
  15. {
  16.     public Player (int positionX, int positionY, char characterSymbol)
  17.     {
  18.         PositionX = positionX;
  19.         PositionY = positionY;
  20.         Symbol = characterSymbol;
  21.     }
  22.  
  23.     public int PositionX { get; private set; }
  24.     public int PositionY { get; private set; }
  25.     public char Symbol { get; private set; }
  26.  
  27. }
  28.  
  29. class Renderer
  30. {
  31.     public void DrawPlayer (Player player)
  32.     {
  33.         Console.SetCursorPosition(player.PositionX, player.PositionY);
  34.         Console.WriteLine(player.Symbol);
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement