feat: add collision check on shape drop.
This commit is contained in:
parent
27c10af424
commit
50a7666246
1 changed files with 7 additions and 1 deletions
8
main.go
8
main.go
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue