Love the tutorial!
One thing I noticed:
current implementation of Grid.world_to_grid doesn't round down towards negative infinity
example: if world_pos is (-15, -15), (-15, 15), (15, -15), or (15, 15), we get a grid cell of (0,0) incorrectly for 3 of these
current
static func world_to_grid(world_pos: Vector2i) -> Vector2i:
var grid_pos: Vector2i = world_pos / tile_size
return grid_pos
correction
static func world_to_grid(world_pos: Vector2i) -> Vector2i:
var grid_pos: Vector2i = (Vector2(world_pos) / Vector2(tile_size)).floor()
return grid_pos
Love the tutorial!
One thing I noticed:
current implementation of Grid.world_to_grid doesn't round down towards negative infinity
example: if
world_posis (-15, -15), (-15, 15), (15, -15), or (15, 15), we get a grid cell of (0,0) incorrectly for 3 of thesecurrent
correction