Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [StartCode]
- using System;
- //Создать класс игрока, у которого есть поля с его положением в x,y.
- //Создать класс отрисовщик, с методом, который отрисует игрока.
- //
- //Попрактиковаться в работе со свойствами.
- namespace oop2
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- char duckPlayer = '2';
- Renderer renderer = new Renderer();
- Player player = new Player(20, 10);
- renderer.PlayerPosition(player.XPosition, player.YPosition, duckPlayer);
- }
- class Player
- {
- public Player(int xPosition, int yPosition)
- {
- XPosition = xPosition;
- YPosition = yPosition;
- }
- public int XPosition { get; }
- public int YPosition { get; }
- }
- class Renderer
- {
- public void PlayerPosition(int x, int y, char duck)
- {
- Console.CursorVisible = false;
- Console.SetCursorPosition(x, y);
- Console.Write(duck);
- }
- }
- }
- }
- [EndCode]
Advertisement
Add Comment
Please, Sign In to add comment