Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Risovanie
- {
- class Player
- {
- public int Y { get; private set;}
- public int X { get; private set; }
- public string strplayer;
- public Player(string player)
- {
- strplayer=player;
- Y = 0;
- X = 0;
- }
- public void drawplayer()
- {
- Console.Write("Установите координаты для рисования\nX:"); //для интереса предоставил выбор координат внутри метода
- X=Convert.ToInt32(Console.ReadLine());
- Console.Write("Y: ");
- Y = Convert.ToInt32(Console.ReadLine());
- string[] array = strplayer.Split("\n"); //разбиваем строку игрока на массив элементов
- for (int i=0;i<array.Length;i++)
- {
- Console.SetCursorPosition(X, Y+i);
- Console.Write(array[i]);
- }
- }
- }
- class Program
- {
- static void Main(string[] args)
- {
- bool open = true;
- while (open)
- {
- Console.WriteLine("Нарисуйте игрока где хотите");
- Player player1 = new Player("\\___/" + "\n|*_*|\n_____\n |\n_____\n/ \\\n");
- player1.drawplayer();
- Console.ReadKey();
- Console.Clear();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment