Skip to content

Instantly share code, notes, and snippets.

@beratdogan
Created December 26, 2015 00:05
Show Gist options
  • Save beratdogan/779af5ccfd1acf7cfcd4 to your computer and use it in GitHub Desktop.
Save beratdogan/779af5ccfd1acf7cfcd4 to your computer and use it in GitHub Desktop.
Module VBModule
Sub Main()
Dim x As Integer = 0
Dim y As Integer = 0
Dim input As ConsoleKeyInfo
Do
input = Console.ReadKey(True)
If input.Key = ConsoleKey.LeftArrow Then
x = x - 1
If x < 0 Then
x = 0
End If
ElseIf input.Key = ConsoleKey.RightArrow Then
x = x + 1
ElseIf input.Key = ConsoleKey.UpArrow Then
y = y - 1
If y < 0 Then
y = 0
End If
ElseIf input.Key = ConsoleKey.DownArrow Then
y = y + 1
End If
Console.Clear()
Console.SetCursorPosition(x, y)
Console.Write("*")
Loop While input.Key <> ConsoleKey.Escape
Console.Clear()
End Sub
End Module
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment