Hello,
In a previous version of my game I had tiles instantiated using a grid and gave them the name of their coordinates. Like 13 would be in x=1 and y=3. This enabled me to keep track of the objects. I needed to change the object clicked on and the one above so I could simply get the name of the object clicked on, increase the y value and look for that object.
This was however not a nice way to do this (first game), so I started looking at better ways to keep track of these instantiated objects. The way I have it now is that they are put in a 2d array (array[,]). However I was assuming I could simply get the index of the object in the array by some magic function. This does not seem to be the way for 2D arrays right? “Array.IndexOf” only seems to work for 1D arrays.
Is there a good way to do this? Or should I do a double for loop again, basically almost being back this more devious method?