added function to get index to tilemap