Update play-pong.ps1

This commit is contained in:
Markus Fleschutz 2023-09-18 20:26:16 +02:00
parent 8af228e009
commit a351f82ee5

View File

@ -1,15 +1,15 @@
<# <#
.SYNOPSIS .SYNOPSIS
Play the Pong game Play the Pong game
.DESCRIPTION .DESCRIPTION
This PowerShell script lets 2 players play the famous Pong game. This PowerShell script lets 2 players play the famous Pong game.
NOTE: Player 1: <W> moves up, <S> moves down | Player 2: <UP> or <DOWN> | <ESC> to quit NOTE: Player 1: <W> moves up, <S> moves down | Player 2: <UP> or <DOWN> | <ESC> to quit
.EXAMPLE .EXAMPLE
PS> ./play-pong.ps1 PS> ./play-pong.ps1
.LINK .LINK
https://github.com/fleschutz/PowerShell https://github.com/fleschutz/PowerShell
.NOTES .NOTES
Author: Markus Fleschutz | License: CC0 Author: Markus Fleschutz | License: CC0
#> #>
function DrawScores { function DrawScores {
@ -34,7 +34,7 @@ function DrawPaddle($y, $isLeft) {
} }
for ($i = 0; $i -lt 5; $i++) { for ($i = 0; $i -lt 5; $i++) {
[System.Console]::SetCursorPosition($x, $y + $i) [System.Console]::SetCursorPosition($x, $y + $i)
[System.Console]::Write("|") [System.Console]::Write("")
} }
} }
@ -55,7 +55,7 @@ function DrawBall($x, $y) {
return return
} }
[System.Console]::SetCursorPosition($x, $y) [System.Console]::SetCursorPosition($x, $y)
Write-Host "o" -foregroundColor red -noNewline Write-Host "🔴" -noNewline
} }
function ClearBall($x, $y) { function ClearBall($x, $y) {