Advertisement
Suslick

Untitled

Aug 6th, 2024 (edited)
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Lesson_1
  4. {
  5.     class Class1
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             Player player = new Player(5, 5, '$');
  10.             Render render = new Render();
  11.  
  12.             render.DrawPlayer(player);
  13.  
  14.             Console.ReadLine();
  15.         }
  16.  
  17.         public class Render
  18.         {
  19.             public void DrawPlayer(Player player)
  20.             {
  21.                 Console.SetCursorPosition(player.PositionX, player.PositionY);
  22.                 Console.Write(player.Sign);
  23.             }
  24.         }
  25.  
  26.         public class Player
  27.         {
  28.             public Player(int positionX, int positionY, char playerSymbol = '@')
  29.             {
  30.                 PositionX = positionX;
  31.                 PositionY = positionY;
  32.                 Sign = playerSymbol;
  33.             }
  34.  
  35.             public int PositionX { get; private set; }
  36.             public int PositionY { get; private set; }
  37.             public char Sign { get; private set; }
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement