lovelyvook

Unit_38

Jul 11th, 2024 (edited)
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.91 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Ijunior
  4. {
  5.     internal class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             Renderer renderer = new Renderer();
  10.             Player player = new Player(20, 10, '@');
  11.  
  12.             renderer.Draw(player);
  13.         }
  14.     }
  15.  
  16.     class Player
  17.     {
  18.         public Player(int x, int y, char symbol)
  19.         {
  20.             PositionX = x;
  21.             PositionY = y;
  22.             Symbol = symbol;
  23.         }
  24.  
  25.         public int PositionX { get; private set; }
  26.         public int PositionY { get; private set; }
  27.         public char Symbol { get; private set; }
  28.     }
  29.  
  30.     class Renderer
  31.     {
  32.         public void Draw(Player player)
  33.         {
  34.             Console.CursorVisible = false;
  35.             Console.SetCursorPosition(player.PositionX, player.PositionY);
  36.             Console.Write(player.Symbol);
  37.             Console.ReadKey(true);
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment