illiden

PlayerXY

Dec 11th, 2019
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.85 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 PlayerXY
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             Player player1 = new Player(10, 5);
  14.             Renderer render = new Renderer();
  15.  
  16.             render.DrawPlayer(player1.X, player1.Y);
  17.             Console.ReadKey();
  18.         }
  19.  
  20.        
  21.     }
  22.  
  23.     class Renderer
  24.     {
  25.         public void DrawPlayer(int x, int y, char symbol = '@')
  26.         {
  27.             Console.SetCursorPosition(x, y);
  28.             Console.Write(symbol);
  29.         }
  30.     }
  31.  
  32.     class Player
  33.     {
  34.         public int X { get; private set; }
  35.         public int Y { get; private set; }
  36.  
  37.         public Player (int x, int y)
  38.         {
  39.             X = x;
  40.             Y = y;
  41.         }
  42.  
  43.     }
  44.  
  45. }
Advertisement
Add Comment
Please, Sign In to add comment