Explain me these codes ...
private var mineField:Array=new Array();
public function Main() {
// mine field creation
for (var i:uint=0; i<FIELD_H; i++) {
mineField=new Array();
for (var j:uint=0; j<FIELD_W; j++) {
mineField.push(0);
}
trace("Row "+i+": "+mineField);
}
trace("The whole mine field: "+mineField);
// end of mine field creation
}
This is a system of multiple array. I copied it from the book of game design. I would like you to explain :
"Why in the trace ""whole mine field" is 81 zeros?"
Ok, I predict (I understood from the book), that private var mineField array is array of i and j
...
I also understood that mineField is an array containing only the i from loop ("0,1,2,3,4,5,6,7,8")
... and mineField.push(0) changes all i-s in array to 0 ?
Please, explain, it all mixes in my head together
