Created
May 14, 2024 04:10
-
-
Save trayforyou/7271c6c0e56d9a0c41aeca2863933637 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 x, int y) | |
{ | |
Skin = skin; | |
X = x; | |
Y = y; | |
} | |
public int X { get; private set; } | |
public int Y { get; private set; } | |
public char Skin { get; private set; } | |
} | |
class Renderer | |
{ | |
public void DrawPlayer(Player player) | |
{ | |
Console.SetCursorPosition(player.X, player.Y); | |
Console.Write(player.Skin); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment