Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace CSLight
- {
- class Menu
- {
- static void Main(string[] args)
- {
- Console.WriteLine("\nВведите координаты расположения персонажа");
- Console.Write("По вертикали(0...10): ");
- int _posX = Convert.ToInt32(Console.ReadLine());
- Console.Write("По горизонтали(0...10): ");
- int _posY = Convert.ToInt32(Console.ReadLine());
- Character character = new Character();
- character.CreateCharacter(_posX, _posY);
- }
- }
- class Character
- {
- private int _x;
- private int _y;
- public int posX
- {
- get
- {
- return _x;
- }
- set
- {
- if(value >= 0 && value <= 10)
- {
- _x = value;
- }
- }
- }
- public int posY
- {
- get
- {
- return _y;
- }
- set
- {
- if (value >= 0 && value <= 10)
- {
- _y = value;
- }
- }
- }
- public char[,] Appearance =
- {
- {' ', '0', ' '},
- {'-', '|', '-'},
- {'/', ' ', 'L'},
- };
- public void CreateCharacter(int posx, int posy)
- {
- Console.Clear();
- Console.SetCursorPosition(posx, posy);
- for (int i = 0; i < Appearance.GetLength(0); i++)
- {
- for (int j = 0; j < Appearance.GetLength(1); j++)
- {
- Console.Write(Appearance[i, j]);
- }
- Console.WriteLine();
- Console.SetCursorPosition(posx, ++posy);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment