I have a tilemap that has four tiles, and i need to write every tile's state (tile position and it's id) into an array.
But i need to check also if there is an object overlapping a tile, and set another value (boolean) to array based on object overlapping.
So, after the loop, array should look like this:
Index |
TileX |
TileY |
TileId |
Overlaps |
0 |
0 |
0 |
0 |
0 |
0 |
0 |
1 |
1 |
1 |
0 |
1 |
0 |
2 |
0 |
0 |
1 |
1 |
3 |
1 |
0: 0, 0, 0, 0 --> last value means that this tile does not overlap with an object
1: 0, 1, 1, 1 --> this tile overlaps with an object
2: 1, 0, 2, 0 --> same with this one
2: 1, 1, 3, 1 --> same with this one
Main idea with this functionality is that after loading tilemap from JSON (on every start of the layout) i need to check tile id and it's overlapping value. If overlapping value has 1, then i change tile's id to a specific value. If overlapping value is 0, then i set tile's id to it's current id-1.
At the moment i'm stuck with an overlapping part. I'm a beginner with with an arrays, and manipulating tilemaps, so i would be very thankful if someone could help me.