ranee

позиция

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