Grid collision check crash

This commit is contained in:
Matt 2020-05-19 11:04:46 -07:00
parent ad9acf4fe1
commit f6eabf5fc3
2 changed files with 4 additions and 4 deletions

View File

@ -313,12 +313,12 @@ namespace Strawberry
public bool Check(Grid grid) public bool Check(Grid grid)
{ {
return grid.Check(SceneHitbox); return grid != null && grid.Check(SceneHitbox);
} }
public bool Check(Grid grid, Point offset) public bool Check(Grid grid, Point offset)
{ {
return grid.Check(SceneHitbox + offset); return grid != null && grid.Check(SceneHitbox + offset);
} }
public bool Check(Entity other) public bool Check(Entity other)

View File

@ -89,7 +89,7 @@ namespace Strawberry
return true; return true;
} }
if (Check(Scene.SolidGrid, .(sign, 0))) if (Check(Scene, .(sign, 0)))
{ {
let c = Collision( let c = Collision(
Point.Right * sign, Point.Right * sign,
@ -134,7 +134,7 @@ namespace Strawberry
return true; return true;
} }
if (Check(Scene.SolidGrid, .(0, sign))) if (Check(Scene, .(0, sign)))
{ {
let c = Collision( let c = Collision(
Point.Right * sign, Point.Right * sign,