In my game, the whole thing is based off of grids. So the map is a dual dimensional array of 32 (32 x 32 grid map). Now what I want to be able to do is to grab a grid and be able to access it and alter it by using a method. To put it simply, I want a method such as Grid grid = getGrid(10, 10); and that would grab the grid at 10 x and 10 y, then when I do some basic edition to the object, it would change the object in the array as well. I don't know how to edit an object after it was changed by being grabbed by a method. I've heard about Java references and I don't know how to use it. I would like help being able to grab an object from an array, pass it on through a method, and be able to save it in another object and when that object is edited, the one in the array is edited. Thanks in advanced!
Tell me more
×
Game Development Stack Exchange is a question and answer site for
professional and independent game developers. It's 100% free, no registration required.
|
closed as off topic by msell, Josh Petrie, Anko, bummzack, Nate 17 hours ago
Questions on Game Development Stack Exchange are expected to relate to game development within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.
From what I understand you want something like this. You can change the name and value from the Grid-object. It refers to the same object as in the array. So this works 'out of the box'. Is this what you mean?
|
|||||||
|