Created
July 22, 2017 06:33
-
-
Save dd86k/9d17225c93f11c07613a0900d1495f7f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
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