mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-26 09:53:57 +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) {
|
function DrawPaddle($y, $isLeft) {
|
||||||
if ($isLeft) {
|
if ($isLeft) {
|
||||||
$x = 0
|
$x = 0
|
||||||
} else {
|
} else {
|
||||||
$x = [System.Console]::WindowWidth - 1
|
$x = [System.Console]::WindowWidth - 1
|
||||||
}
|
}
|
||||||
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("▌")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ClearPaddle($y, $isLeft) {
|
function ClearPaddle($y, $isLeft) {
|
||||||
@ -83,7 +83,7 @@ function UpdateBall {
|
|||||||
$nextX = $script:ball.X
|
$nextX = $script:ball.X
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($nextX -lt 0) {
|
if ($nextX -lt 0) {
|
||||||
$script:scorePlayer2++
|
$script:scorePlayer2++
|
||||||
DrawScores
|
DrawScores
|
||||||
$nextX = [System.Console]::WindowWidth / 2
|
$nextX = [System.Console]::WindowWidth / 2
|
||||||
|
Loading…
Reference in New Issue
Block a user