feat: detect game over condition and switch state.
This commit is contained in:
parent
cae34a52aa
commit
54a7821df0
1 changed files with 4 additions and 0 deletions
|
|
@ -110,6 +110,10 @@ func (gp *GamePlay) Update(fsm state.Transitioner, delta float32) {
|
||||||
gp.score.Lines(num_rows)
|
gp.score.Lines(num_rows)
|
||||||
}
|
}
|
||||||
gp.SpawnShape()
|
gp.SpawnShape()
|
||||||
|
|
||||||
|
if game.CheckShapeCollision(gp.shape_pos, &gp.shape, &gp.grid) {
|
||||||
|
fsm.Switch("gameover")
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
gp.shape_pos = new_pos
|
gp.shape_pos = new_pos
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue