feat(collision): check grid bounds in x axis.
This commit is contained in:
parent
5853fb1238
commit
aeaf6cb5c4
1 changed files with 4 additions and 0 deletions
|
|
@ -11,6 +11,10 @@ func CheckShapeCollision(pos core.Vec2i8, shape *Shape, grid *Grid) bool {
|
|||
continue
|
||||
}
|
||||
|
||||
if block.X < 0 || block.X >= int8(grid.Width()) {
|
||||
return true
|
||||
}
|
||||
|
||||
// Check if the block collides with the bottom of the grid.
|
||||
if block.Y >= int8(grid.Height()) {
|
||||
return true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue