SHOW:
|
|
- or go back to the newest paste.
| 1 | using System; | |
| 2 | ||
| 3 | namespace C_sharp_Light | |
| 4 | {
| |
| 5 | class Program | |
| 6 | {
| |
| 7 | static void Main(string[] args) | |
| 8 | {
| |
| 9 | - | |
| 9 | + | Console.CursorVisible = false; |
| 10 | Player player = new Player(5,5,'@'); | |
| 11 | Renderer render = new Renderer(); | |
| 12 | render.Draw(player); | |
| 13 | Console.ReadKey(); | |
| 14 | } | |
| 15 | } | |
| 16 | ||
| 17 | class Player | |
| 18 | {
| |
| 19 | private int _x; | |
| 20 | private int _y; | |
| 21 | public int X | |
| 22 | {
| |
| 23 | get | |
| 24 | {
| |
| 25 | return _x; | |
| 26 | } | |
| 27 | private set | |
| 28 | {
| |
| 29 | _x = value; | |
| 30 | } | |
| 31 | } | |
| 32 | public int Y | |
| 33 | {
| |
| 34 | get | |
| 35 | {
| |
| 36 | return _y; | |
| 37 | } | |
| 38 | private set | |
| 39 | {
| |
| 40 | _y = value; | |
| 41 | } | |
| 42 | } | |
| 43 | public char Symbol { get; private set; }
| |
| 44 | ||
| 45 | public Player(int x, int y, char charPlayer) | |
| 46 | {
| |
| 47 | X = x; | |
| 48 | Y = y; | |
| 49 | Symbol = charPlayer; | |
| 50 | } | |
| 51 | ||
| 52 | } | |
| 53 | class Renderer | |
| 54 | {
| |
| 55 | public void Draw(Player player) | |
| 56 | {
| |
| 57 | Console.SetCursorPosition(player.X, player.Y); | |
| 58 | Console.Write(player.Symbol); | |
| 59 | } | |
| 60 | } | |
| 61 | ||
| 62 | } |