boolean isTopLeftSolid = isSolid(x, y, level);
boolean isTopRightSolid = isSolid(x + width, y, level);
boolean isBottomLeftSolid = isSolid(x, y+height, level);
boolean isBottomRightSolid = isSolid(x+width, y+height, level);
if (canMoveToPosition(hitbox.x + xDirection, hitbox.y, hitbox.width, hitbox.height, level))
hitbox.x += xDirection;
boolean isTopLeftSolid = isSolid(x, y, level);
boolean isTopRightSolid = isSolid(x + width, y, level);
boolean isBottomLeftSolid = isSolid(x, y+height, level);
boolean isBottomRightSolid = isSolid(x+width, y+height, level);
if (canMoveToPosition(hitbox.x + xDirection, hitbox.y, hitbox.width, hitbox.height, level))
hitbox.x += xDirection;