Skip to main content

Timeline for Inventory Grid Detection

Current License: CC BY-SA 3.0

6 events
when toggle format what by license comment
Mar 23, 2013 at 6:09 vote accept BattleBarnes
Mar 23, 2013 at 6:08 comment added user1306322 Sometimes (actually more often than most programmers are willing to admit) it is better to put aside existing code and think again how you would solve a problem, like in this case.
Mar 23, 2013 at 6:07 comment added BattleBarnes Final comment! Your solution is in fact the same as what I'm doing (but it is waaay neater) - my problem was in placing the item. The formula I ended up with is slot = 5*rowPos + colPos and now it works. Thanks all the same, you made me examine my code more closely.
Mar 23, 2013 at 5:57 comment added BattleBarnes Actually, this only solves half my problem. See, the inventory is an ArrayList, not a 2D array, so I can't just put the item in [x][y], I have to turn x and y into a slot ID between 0-39. I had that as x + 4*y, but that doesn't seem to be playing well. Any ideas?
Mar 23, 2013 at 5:52 comment added BattleBarnes This makes a lot of sense, though I feel like it's almost exactly what I'm doing, just neater. I'm gonna play around with this, and see if it works better. Also, thanks! I like my metal dude.
Mar 23, 2013 at 5:44 history answered user1306322 CC BY-SA 3.0