Discretize movement.
This commit is contained in:
parent
015375bbc3
commit
cad36f97a7
2
game.go
2
game.go
|
@ -85,7 +85,7 @@ func gameOver(s state) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
steps = 500
|
steps = 40
|
||||||
numBots = 10
|
numBots = 10
|
||||||
numTeams = 4
|
numTeams = 4
|
||||||
)
|
)
|
||||||
|
|
8
main.go
8
main.go
|
@ -26,9 +26,11 @@ func run() {
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
|
|
||||||
for !w.Closed() && !s.gameOver {
|
for !w.Closed() && !s.gameOver {
|
||||||
w.Clear(colornames.Peru)
|
if w.JustPressed(pixelgl.KeySpace) {
|
||||||
s = updateState(s)
|
w.Clear(colornames.Peru)
|
||||||
render(s, w, time.Since(start), colors)
|
s = updateState(s)
|
||||||
|
render(s, w, time.Since(start), colors)
|
||||||
|
}
|
||||||
w.Update()
|
w.Update()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue