F
Fabian
function getImage(id,x,y) {
if (mpdef[0 + yy + y][0 + xx + x] == undefined) {
// set to default image
document.getElementById(id).src = terrdef[13];
}
else {
document.getElementById(id).src = terrdef[ mpdef[0 + yy + y][0 + xx
+ x] ];
}
return;
}
I use this function to grab an index number which refers to a graphics
file. In theory, firt it checks to see if the mpdef array has a valid
value as teh specified row/colum index, and then either puts in a
default index number or grabs the index number from teh array, depending
on whether the mpdef array has a value at that location.
However, it seems to choke when either teh referenced row or column
is -1 or lower. How should I catch this?
if (mpdef[0 + yy + y][0 + xx + x] == undefined) {
// set to default image
document.getElementById(id).src = terrdef[13];
}
else {
document.getElementById(id).src = terrdef[ mpdef[0 + yy + y][0 + xx
+ x] ];
}
return;
}
I use this function to grab an index number which refers to a graphics
file. In theory, firt it checks to see if the mpdef array has a valid
value as teh specified row/colum index, and then either puts in a
default index number or grabs the index number from teh array, depending
on whether the mpdef array has a value at that location.
However, it seems to choke when either teh referenced row or column
is -1 or lower. How should I catch this?