I'm dealing with arrays, this is at least a torment =
Next time I will read the entire wikia to understand how to solve a matrix using arrays.
The problem happened when I was doing an autotile behavior, where each existent tile was stored in the array with 0, else -1, then a "For each ordered" event, it should pick the tile and count how many tiles are surrounding it, sum a number for each position.
For example, a random tile in the looping event will check on the left upper corner, if it's existent, add 1 and make the same for every surround existent tiles, but each one have a number, upper is 2, right upper corner is 3 and so on.
1-2-3
4-5-6
7-8-9
It will give the array slot a sum, where the sum can be related to a Tile ID, so, I did a dictionary to relate it.
If the sum return, for example, is 6, I know it's the left upper corner, because it's being surrounded by 2 and 4, so, 2+4=6
The problem is how to solve the array to achieve it, I tried to to use tilemap.at(array.curx-1,array.cury-1) to check the left upper corner and it didn't checked correctly, also, didn't made the sum.
Well, this is my labor for a while, while I don't figure out how arrays works.