ranee

позиция

Feb 16th, 2023 (edited)
948
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 int PositionX { get; private set; }
  18.         public int PositionY { get; private set; }
  19.         public Player (int positionX, int positionY)
  20.         {
  21.             PositionX = positionX;
  22.             PositionY = positionY;
  23.         }
  24.     }
  25.  
  26.     class Renderer
  27.     {
  28.         public void DrawPlayer(int positionX, int positionY, char playersimbol = '*')
  29.         {
  30.             Console.SetCursorPosition(positionX, positionY);
  31.             Console.Write(playersimbol);
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment