Dodany pierwszy gracz w calosci.

Teraz musze wymyslic sposob bym nie musial potwierdzac wyboru up/down
This commit is contained in:
knmarcin 2018-11-17 09:25:33 +01:00
parent cfa61b69c4
commit df3089dcbc
2 changed files with 17 additions and 23 deletions

BIN
Pong

Binary file not shown.

16
Pong.go
View File

@ -17,17 +17,17 @@ var BallDirection [10][30]string
var BallSpeed int
var GameOver bool = false
var LastPressedKey rune
func main() {
SpawnEverything()
}
func SpawnEverything() {
CreateBoard()
SpawnPlayers()
SpawnBall()
PrintBoard()
Loop()
}
func SpawnEverything() {
}
func CreateBoard() {
@ -49,25 +49,20 @@ func PrintBoard() {
fmt.Print("\n")
}
}
func SpawnBall() {
x = 4
y = 14
gameBoard[x][y] = "o"
}
func SpawnPlayers() {
for i = 0; i < 10; i++ {
Player1[i] = " "
Player2[i] = " "
}
for i = 3; i < 6; i++ {
Player1[i] = "|"
Player2[i] = "|"
j = 0
gameBoard[i][0] = Player1[i]
gameBoard[i][29] = Player2[i]
}
@ -83,7 +78,6 @@ func Loop() {
gameBoard[P1index][0] = "|"
gameBoard[P1index + 3][0] = " "
PrintBoard()
} else {
PrintBoard()
}