Poprawione formatowanie. Wciaz musze zaimplementowac "action key"
This commit is contained in:
parent
df3089dcbc
commit
5a3ca97d0a
39
Pong.go
39
Pong.go
@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"bufio"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
@ -71,26 +72,28 @@ func Loop() {
|
|||||||
i = 5
|
i = 5
|
||||||
P1index=3
|
P1index=3
|
||||||
for GameOver == false {
|
for GameOver == false {
|
||||||
fmt.Scanf("%c", &LastPressedKey)
|
fmt.Scanf("%c", &LastPressedKey)
|
||||||
if LastPressedKey == 'w' {
|
if LastPressedKey == 'w' {
|
||||||
if P1index != 0 {
|
if P1index != 0 {
|
||||||
P1index--
|
P1index--
|
||||||
gameBoard[P1index][0] = "|"
|
gameBoard[P1index][0] = "|"
|
||||||
gameBoard[P1index + 3][0] = " "
|
gameBoard[P1index + 3][0] = " "
|
||||||
PrintBoard()
|
PrintBoard()
|
||||||
} else {
|
} else {
|
||||||
PrintBoard()
|
PrintBoard()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if LastPressedKey=='s' {
|
||||||
if LastPressedKey=='s' {
|
if P1index!=7 {
|
||||||
if P1index!=7 {
|
gameBoard[P1index][0] = " "
|
||||||
gameBoard[P1index][0] = " "
|
P1index++
|
||||||
P1index++
|
gameBoard[P1index + 2][0] = "|"
|
||||||
gameBoard[P1index + 2][0] = "|"
|
PrintBoard()
|
||||||
PrintBoard()
|
} else {
|
||||||
} else {
|
PrintBoard()
|
||||||
PrintBoard()
|
}
|
||||||
|
}
|
||||||
|
if LastPressedKey=='r' {
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user