extends Node

var TILE_SIZE: float:
	get:
		return BattleMapConstants.TILE_SIZE


func snap_to_grid(pos: Vector2) -> Vector2:
	return Vector2(floorf(pos.x / TILE_SIZE), floorf(pos.y / TILE_SIZE)) * TILE_SIZE


func world_to_coords(pos: Vector2) -> Vector2i:
	return Vector2i(snap_to_grid(pos) / TILE_SIZE)


func coords_to_world(coords: Vector2i) -> Vector2:
	return Vector2(coords) * TILE_SIZE
