Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/02/2016, 20:14
Christian117
 
Fecha de Ingreso: febrero-2016
Mensajes: 1
Antigüedad: 8 años, 3 meses
Puntos: 0
Pregunta Tengo que hacer un programa, donde pueda mover una "x" en toda la pantalla usando las

TENGO QUE HACER UN PROGRAMA, DONDE PUEDA MOVER UNA "X" EN TODA LA PANTALLA USANDO LAS FLECHAS DEL TECLADO....

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int x = 0;
int y = 0;

ConsoleKeyInfo Letra;

do
{
Console.SetCursorPosition(x, y);
Console.Write("x");
Letra = Console.ReadKey();
if (Letra.Key == ConsoleKey.RightArrow)
{
Console.SetCursorPosition(x, y);
Console.Write(" ");
x++;
}
else if (Letra.Key == ConsoleKey.LeftArrow)
{
Console.SetCursorPosition(x, y);
Console.Write(" ");
x--;
}
else if (Letra.Key == ConsoleKey.UpArrow)
{
Console.SetCursorPosition(x, y);
Console.Write(" ");
y++;
}
else if (Letra.Key == ConsoleKey.DownArrow)
{
Console.SetCursorPosition(x, y);
Console.Write(" ");
y--;
}

} while (Letra.Key != ConsoleKey.Escape);
}
}
}