Update play-pong.ps1

This commit is contained in:
Markus Fleschutz 2023-09-19 20:34:00 +02:00
parent 5b2a69b336
commit a217faecee

View File

@ -27,15 +27,15 @@ function DrawFooter {
}
function DrawPaddle($y, $isLeft) {
if ($isLeft) {
$x = 0
} else {
$x = [System.Console]::WindowWidth - 1
}
for ($i = 0; $i -lt 5; $i++) {
[System.Console]::SetCursorPosition($x, $y + $i)
[System.Console]::Write("")
}
if ($isLeft) {
$x = 0
} else {
$x = [System.Console]::WindowWidth - 1
}
for ($i = 0; $i -lt 5; $i++) {
[System.Console]::SetCursorPosition($x, $y + $i)
[System.Console]::Write("")
}
}
function ClearPaddle($y, $isLeft) {
@ -83,7 +83,7 @@ function UpdateBall {
$nextX = $script:ball.X
}
if ($nextX -lt 0) {
if ($nextX -lt 0) {
$script:scorePlayer2++
DrawScores
$nextX = [System.Console]::WindowWidth / 2