Question by
Ambrose998800 · Mar 22, 2016 at 03:58 AM ·
2d array
Get 2D position of an array element
For my inventory I need to find free places in the 2d array:
Example; InvGrid (0 = null; n = item_n)
0 0 0 0 0 0 0 0
0 0 0 0 1 1 0 0
0 2 0 0 1 1 0 0
0 2 0 0 0 0 0 0
0 0 0 3 3 3 0 0
0 0 0 3 3 3 0 0
Now I want an item (item_4) to read out all free (0) positions to find a place it would fit in.
Whats the best way to get that? Thx
Comment
Answer by Ambrose998800 · Mar 22, 2016 at 05:29 PM
Well, I've tried with "var i = InvGrid[Item_4_PosX, Item_4_PosY];" with item_Pos < InvGrid.length. Wont work...
Your answer
Follow this Question
Related Questions
Array 2D of data 1 Answer
NullReferenceException in Update() 0 Answers
2D array of Text 0 Answers
How do I check for adjacent tiles of the same type? 1 Answer
Differentiating similar components attached to a game object in script? 0 Answers