Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace Task_1_3_5
- {
- class Program
- {
- static void Main()
- {
- int currentPositionX = 0;
- int currentPositionY = 0;
- while(true)
- {
- ConsoleKey input = Console.ReadKey(true).Key;
- Console.Clear();
- Console.WriteLine("x {0}, y{1}",currentPositionX,currentPositionY);
- if(input == ConsoleKey.A)
- {
- currentPositionX--;
- }
- else if(input == ConsoleKey.W)
- {
- currentPositionY++;
- }
- else if(input == ConsoleKey.D)
- {
- currentPositionX++;
- }
- else if(input == ConsoleKey.S)
- {
- currentPositionY--;
- }
- else if(input == ConsoleKey.Escape)
- {
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment