I have spent the last hour trying to get
to work with this array:
Now it seems my most promising solution was to try this.
I have tried a few other things like bringing in the x and y variables in first, then using them, but that didn't work. I have watched a few videos on using multiple constructors/classes and the private, public, and this keywords, but I cannot figure it out. Any help would be appreciated.
public class Moving {
private int myY = 0;
private int myX = 0;
public void coord( int x, int y ){
x = 0;
y = 0;
myX = x; //these variables (x and y)
myY = y;
}
}
to work with this array:
public class Rooms {
Moving MovingObject = new Moving();
public String roomTitle = "";
public String roomDescription = "";
public void roomLocation(){
int room[][]={{0, 1, 2, 3, 4, 5, 6},
{7, 8, 9, 10,11,12,13},
{14,15,16,17,18,19,20},
{21,22,23,24,25,26,27},
{28,29,30,31,32,33,34}};
}
}
Now it seems my most promising solution was to try this.
room[MovingObject.coord.x][MovingObject.coord.y];
I have tried a few other things like bringing in the x and y variables in first, then using them, but that didn't work. I have watched a few videos on using multiple constructors/classes and the private, public, and this keywords, but I cannot figure it out. Any help would be appreciated.