Hi when I call the the function below in the chrome console it tells me "Type error cannot read property '2' of undefined" why?.
defining the map:
var map = {
FALL:[
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[3, 0, 0, 2, 0, 0, 0, 3, 0, 0, 3]
],
}
Function:
for (i = 0; i < 4; i++) {
console.log(map.FALL[pmx-i]
[pmy-1]);
if(map.FALL[pmx-i][pmy-1] > 0){
return true;
break;
}
by the way pmx = 1 pmy=3
console.log(pmx-i)
before the failing line, or using Chrome's debugging tools. – Anko Jun 7 at 10:42