mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-26 01:43:37 +01:00
Update play-pong.ps1
This commit is contained in:
parent
5b2a69b336
commit
a217faecee
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user