fiddle main conditional flow

This commit is contained in:
Luke Meyers 2020-02-08 21:27:50 -08:00
parent f06400d905
commit ea9f41e581
1 changed files with 18 additions and 16 deletions

10
main.go
View File

@ -48,14 +48,15 @@ func run() error {
go func() { cmdC <- game.PollCommands(s) }()
for !w.Closed() && !s.GameOver {
switch {
case w.Pressed(pixelgl.KeyQ):
return nil
case rs.Animating:
if rs.Animating {
rs = gfx.Render(rs, sOld, s, w, *sb)
if !rs.Animating {
sOld = s
}
} else {
switch {
case w.Pressed(pixelgl.KeyQ):
return nil
case w.Pressed(pixelgl.KeySpace) || true:
log.Printf("TURN %d", turn)
rs.Animating = true
@ -71,6 +72,7 @@ func run() error {
}
go func() { cmdC <- game.PollCommands(s) }()
}
}
w.Update()
frames++