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
29
Pong.go
29
Pong.go
@ -12,14 +12,15 @@ var Player2 [10]string
|
||||
var Ball [10][30]string
|
||||
var BallDirection [10][30]string
|
||||
var BallSpeed int
|
||||
var GameOver bool
|
||||
var LastPressedKey byte
|
||||
var GameOver bool = false
|
||||
var LastPressedKey string
|
||||
func main() {
|
||||
fmt.Println("hello world!")
|
||||
CreateBoard()
|
||||
SpawnPlayers()
|
||||
SpawnBall()
|
||||
PrintBoard()
|
||||
Loop()
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -64,17 +65,17 @@ func SpawnPlayers() {
|
||||
gameBoard[i][0] = Player1[i]
|
||||
gameBoard[i][29] = Player2[i]
|
||||
}
|
||||
func TestingGit() {
|
||||
|
||||
fmt.Print("Sprawdzam")
|
||||
}
|
||||
|
||||
func Loop() {
|
||||
GameOver = false
|
||||
for GameOver = false {
|
||||
if _,err:= fmt.Scan(&LastPressedKey);
|
||||
if LastPressedKey == "w"
|
||||
}
|
||||
|
||||
|
||||
i = 5
|
||||
for GameOver == false {
|
||||
fmt.Scanf("%s", &LastPressedKey)
|
||||
if LastPressedKey == "w" {
|
||||
gameBoard[2][0] = "|"
|
||||
gameBoard[5][0] = " "
|
||||
i=i-1
|
||||
PrintBoard()
|
||||
}
|
||||
}
|
||||
PrintBoard()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user