Dodany pierwszy gracz w calosci.
Teraz musze wymyslic sposob bym nie musial potwierdzac wyboru up/down
This commit is contained in:
parent
cfa61b69c4
commit
df3089dcbc
16
Pong.go
16
Pong.go
@ -17,17 +17,17 @@ var BallDirection [10][30]string
|
|||||||
var BallSpeed int
|
var BallSpeed int
|
||||||
var GameOver bool = false
|
var GameOver bool = false
|
||||||
var LastPressedKey rune
|
var LastPressedKey rune
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
SpawnEverything()
|
||||||
|
}
|
||||||
|
|
||||||
|
func SpawnEverything() {
|
||||||
CreateBoard()
|
CreateBoard()
|
||||||
SpawnPlayers()
|
SpawnPlayers()
|
||||||
SpawnBall()
|
SpawnBall()
|
||||||
PrintBoard()
|
PrintBoard()
|
||||||
Loop()
|
Loop()
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func SpawnEverything() {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateBoard() {
|
func CreateBoard() {
|
||||||
@ -49,25 +49,20 @@ func PrintBoard() {
|
|||||||
fmt.Print("\n")
|
fmt.Print("\n")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func SpawnBall() {
|
func SpawnBall() {
|
||||||
x = 4
|
x = 4
|
||||||
y = 14
|
y = 14
|
||||||
gameBoard[x][y] = "o"
|
gameBoard[x][y] = "o"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func SpawnPlayers() {
|
func SpawnPlayers() {
|
||||||
for i = 0; i < 10; i++ {
|
for i = 0; i < 10; i++ {
|
||||||
Player1[i] = " "
|
Player1[i] = " "
|
||||||
Player2[i] = " "
|
Player2[i] = " "
|
||||||
}
|
}
|
||||||
|
|
||||||
for i = 3; i < 6; i++ {
|
for i = 3; i < 6; i++ {
|
||||||
Player1[i] = "|"
|
Player1[i] = "|"
|
||||||
Player2[i] = "|"
|
Player2[i] = "|"
|
||||||
j = 0
|
j = 0
|
||||||
|
|
||||||
gameBoard[i][0] = Player1[i]
|
gameBoard[i][0] = Player1[i]
|
||||||
gameBoard[i][29] = Player2[i]
|
gameBoard[i][29] = Player2[i]
|
||||||
}
|
}
|
||||||
@ -83,7 +78,6 @@ func Loop() {
|
|||||||
gameBoard[P1index][0] = "|"
|
gameBoard[P1index][0] = "|"
|
||||||
gameBoard[P1index + 3][0] = " "
|
gameBoard[P1index + 3][0] = " "
|
||||||
PrintBoard()
|
PrintBoard()
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
PrintBoard()
|
PrintBoard()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user