1
0
Fork 0

feat: add collision check on shape drop.

This commit is contained in:
Henrik Hautakoski 2025-09-14 22:07:58 +02:00
parent 27c10af424
commit 50a7666246

View file

@ -48,7 +48,13 @@ func main() {
for !rl.WindowShouldClose() {
if dropTimer.UpdateReset(rl.GetFrameTime()) {
shape_pos.Y += 1
new_pos := shape_pos
new_pos.Y += 1
// Update position if it does not collide
if !game.CheckShapeCollision(new_pos, &shape, &grid) {
shape_pos = new_pos
}
}
render.Begin(r.Theme.GridBackground)