I'm trying to make 2D field:
var field=[];
N = 8;
M = 12;
for (Y=0;Y<M;Y++){
for (X=0;X<N;X++){
field[X,Y]=0; //trying to make 2d field with coordinates X,Y
};
};
function functiontest(){
field[3,10]=1; //trying to set to coordinates "3,10" value 1
alert(field[2,10]); //ALERTS 1 for some reason
};
I'm trying to set value 1 to coordinates "3, 10" ,but it sets value 1 to all coordinates, which have second coordinates (X,10). When I add script, that sets blue background to DIV with value 1 (id is same as coordinates), it sets it for the whole line.
function functionblue(){
for (Y=0;Y<M;Y++){
for (X=0;X<N;Z++){
if (field[X,Y]==0){
$("#z"+X+""+Y).css("background","blue"); //Divs and its IDs work properly
};
};
};
};
so how do I set value just toto one point (not line)?
field[X,Y]tofield[X][Y].