Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save trayforyou/2167bbdd6efda5b8f3b4bc85ca41a618 to your computer and use it in GitHub Desktop.
Save trayforyou/2167bbdd6efda5b8f3b4bc85ca41a618 to your computer and use it in GitHub Desktop.
using System;
namespace OOP_number_2
{
internal class Program
{
static void Main(string[] args)
{
Player player = new Player('@', 2, 20);
Renderer renderer = new Renderer();
renderer.DrawPlayer(player);
Console.ReadKey();
}
}
class Player
{
public Player(char skin, int positionX, int positionY)
{
Skin = skin;
PositionX = positionX;
PositionY = positionY;
}
public int PositionX { get; private set; }
public int PositionY { get; private set; }
public char Skin { get; private set; }
}
class Renderer
{
public void DrawPlayer(Player player)
{
Console.SetCursorPosition(player.PositionX, player.PositionY);
Console.Write(player.Skin);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment