Setting camera right limit to tilemap far right tile / cell

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By golden9

Hi, so I ran into this problem while creating scrolling runner game. I wonder how can I get farthest ground cell’s position from right and set camera limit right to that…

var used_cells_array = tilemap.get_used_cells_by_id(tilemap.tile_set.find_tile_by_name("ground"))
get_parent().get_node("Player/Camera").limit_right = int(to_global(tilemap.map_to_world(used_cells_array[used_cells_array.size()-1])).x)

I noticed it does not work because when I enter remote mode and increase limit right I can see more ground tiles on the right…

Tilemap ground cells should be set / indexed from left to right…

Apologies for bad English

:bust_in_silhouette: Reply From: golden9

Turns out generation speed seem to be the issue, I ended up using another way to end the level instead of camera limit so issue no longer needs to be solved.