Game Development Reference
In-Depth Information
//Stores all layers of map
public class
LayerList{
public
ArrayList<Layer>
layerList
=
new
ArrayList<Layer>();
//Static method, returns a LayerList containing a list of all layers
public static
LayerList getLayerListByStage(
int
stage){
Layer layer;
LayerList list=
new
LayerList();
//Reads map details from GameData and adds them to LayerList
for
(
int
i=0;i<GameData.
mapData
[stage].
length
;i++){
layer =
new
Layer(GameData.
mapData
[stage][i]);
list.
layerList
.add(layer);
}
return
list;
}
//Returns the impassable path matrix for all layers
public int
[][] getTotalNotInMatrix(){
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++){
for
(Layer layer:
layerList
){
result[i][j] =
result[i][j]|layer.
notInMarix
[i][j];
}
}
}
return
result;
}
}
Search WWH ::
Custom Search