Dodalem pierwsza mozliwosc poruszania sie w gore za pomoca klawisza "w", niestety na razie z enterem, ale pozniej do tego wroce. Teraz bede musial dodac osobny increment do Playera1 i wymyslic jakis mechanizm bym mogl isc do gory, oczywiscie bedzie tez potrzebna blokada.
This commit is contained in:
parent
42f84de695
commit
ed85c1ca11
27
Pong.go
27
Pong.go
@ -12,14 +12,15 @@ var Player2 [10]string
|
|||||||
var Ball [10][30]string
|
var Ball [10][30]string
|
||||||
var BallDirection [10][30]string
|
var BallDirection [10][30]string
|
||||||
var BallSpeed int
|
var BallSpeed int
|
||||||
var GameOver bool
|
var GameOver bool = false
|
||||||
var LastPressedKey byte
|
var LastPressedKey string
|
||||||
func main() {
|
func main() {
|
||||||
fmt.Println("hello world!")
|
|
||||||
CreateBoard()
|
CreateBoard()
|
||||||
SpawnPlayers()
|
SpawnPlayers()
|
||||||
SpawnBall()
|
SpawnBall()
|
||||||
PrintBoard()
|
PrintBoard()
|
||||||
|
Loop()
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,17 +65,17 @@ func SpawnPlayers() {
|
|||||||
gameBoard[i][0] = Player1[i]
|
gameBoard[i][0] = Player1[i]
|
||||||
gameBoard[i][29] = Player2[i]
|
gameBoard[i][29] = Player2[i]
|
||||||
}
|
}
|
||||||
func TestingGit() {
|
|
||||||
|
|
||||||
fmt.Print("Sprawdzam")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func Loop() {
|
func Loop() {
|
||||||
GameOver = false
|
i = 5
|
||||||
for GameOver = false {
|
for GameOver == false {
|
||||||
if _,err:= fmt.Scan(&LastPressedKey);
|
fmt.Scanf("%s", &LastPressedKey)
|
||||||
if LastPressedKey == "w"
|
if LastPressedKey == "w" {
|
||||||
|
gameBoard[2][0] = "|"
|
||||||
|
gameBoard[5][0] = " "
|
||||||
|
i=i-1
|
||||||
|
PrintBoard()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
PrintBoard()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user