Created
May 15, 2024 02:14
-
-
Save trayforyou/2167bbdd6efda5b8f3b4bc85ca41a618 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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