Game Development Reference
In-Depth Information
this . notInMarix = getNotInMatrix(mapMatrix);;
}
//Returns a 2D array of int[][] that represents an impassable path matrix
public int [][] getNotInMatrix( int [][] mapMatrix){
int [][] result = new int [ MAP_ROWS ][ MAP_COLS ];
for ( int i=0;i<result. length ;i++){
for ( int j=0;j<result[i]. length ;j++){
result[i][j] = getBlock (mapMatrix[i][j]);
}
}
return result;
}
//Returns a drawable map matrix based on the map data
//specified in mapMatrix
public static MyDrawable [][] getMyDrawableMatrix( int [][] mapMatrix){
MyDrawable
[][]
result
=
new
MyDraw-
able[ MAP_ROWS ][ MAP_COLS ];
for ( int i=0;i< MAP_ROWS ;i++){
for ( int j=0;j< MAP_COLS ;j++){
if (mapMatrix[i][j]>0){
result[i][j]
= new MyDrawable(mapMatrix[i][j], TILE_SIZE );
}
}
}
return result;
}
}
All layers of map are encapsulated in the LayerList class, which provides a method to re-
trieve the impassable path matrix for all layers of the specified stage.
Search WWH ::




Custom Search