Advertisement
bonumopus

drawPlayer1

May 14th, 2020
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.39 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace drawPlayer
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Player player = new Player(7,10);
  14.             Renderer render = new Renderer();
  15.  
  16.             render.DrawUnit(player.X,player.Y);
  17.         }
  18.  
  19.         class Renderer
  20.         {
  21.             public void DrawUnit(int x, int y, char ch = '@')
  22.             {
  23.                 Console.SetCursorPosition(x, y);
  24.                 Console.Write(ch);
  25.                 Console.WriteLine("\n\n\n");
  26.                 Console.ReadKey();
  27.             }
  28.         }
  29.  
  30.         class Player
  31.         {
  32.             private int _x;
  33.             private int _y;
  34.  
  35.             public int X
  36.             {
  37.                 get
  38.                 {
  39.                     return _x;
  40.                 }
  41.                 private set
  42.                 {
  43.                     _x = value;
  44.                 }
  45.             }
  46.  
  47.             public int Y
  48.             {
  49.                 get
  50.                 {
  51.                     return _y;
  52.                 }
  53.                 private set
  54.                 {
  55.                     _y = value;
  56.                 }
  57.             }
  58.  
  59.             public Player (int x, int y)
  60.             {
  61.                 _x = x;
  62.                 _y = y;
  63.             }
  64.         }
  65.     }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement