1
0
Fork 0

feat: detect game over condition and switch state.

This commit is contained in:
Henrik Hautakoski 2025-09-24 17:59:45 +02:00
parent cae34a52aa
commit 54a7821df0

View file

@ -110,6 +110,10 @@ func (gp *GamePlay) Update(fsm state.Transitioner, delta float32) {
gp.score.Lines(num_rows)
}
gp.SpawnShape()
if game.CheckShapeCollision(gp.shape_pos, &gp.shape, &gp.grid) {
fsm.Switch("gameover")
}
} else {
gp.shape_pos = new_pos
}