Skip to content

Instantly share code, notes, and snippets.

@jda0
Created December 12, 2013 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jda0/7932249 to your computer and use it in GitHub Desktop.
Save jda0/7932249 to your computer and use it in GitHub Desktop.
Module Module1
Dim x, y As Integer
Dim k As ConsoleKeyInfo
Sub Main()
x = 0
y = 0
Console.SetCursorPosition(x, y)
Do
Console.Clear()
Console.SetCursorPosition(0, Console.WindowHeight - 2)
Console.WriteLine(x & ", " & y)
Console.SetCursorPosition(x, y)
k = Console.ReadKey()
Select Case k.Key
Case ConsoleKey.LeftArrow
x -= 1
If x < 0 Then x = 0
Case ConsoleKey.UpArrow
y -= 1
If y < 0 Then y = 0
Case ConsoleKey.RightArrow
x += 1
If x > Console.WindowWidth - 1 Then x = Console.WindowWidth - 1
Case ConsoleKey.DownArrow
y += 1
If y > Console.WindowHeight - 2 Then y = Console.WindowHeight - 2
End Select
Console.SetCursorPosition(x, y)
Loop
End Sub
End Module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment