Skip to content

Instantly share code, notes, and snippets.

@dd86k
Created July 22, 2017 06:33
Show Gist options
  • Save dd86k/9d17225c93f11c07613a0900d1495f7f to your computer and use it in GitHub Desktop.
Save dd86k/9d17225c93f11c07613a0900d1495f7f to your computer and use it in GitHub Desktop.
<#
Bored shit
by dd86k
#>
function ErasePlayer() {
[Console]::SetCursorPosition($x, $y); ' '
}
function PrintPlayer() {
[Console]::SetCursorPosition($x, $y); '@'
}
$x = [Console]::WindowWidth / 2
$y = [Console]::WindowHeight / 2
PrintPlayer
Clear-Host
while ($true) {
$ki = [Console]::ReadKey($true)
switch ($ki.key) {
LeftArrow {
ErasePlayer
--$x
PrintPlayer
}
RightArrow {
ErasePlayer
++$x
PrintPlayer
}
UpArrow {
ErasePlayer
--$y
PrintPlayer
}
DownArrow {
ErasePlayer
++$y
PrintPlayer
}
q { exit 0 }
default {
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment