gollum1990
Neues Mitglied
Hallo,
habe Problem mitz length attribut dat will nit,
der sagt length ist null oder kein Object
hier der Code.
danke im vorruas für hilfe.
habe Problem mitz length attribut dat will nit,
der sagt length ist null oder kein Object
hier der Code.
PHP:
<script type="text/javascript">
var map = [[1,1,1,1,1,1,1,1,1,1],
[1,0,0,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,0,0,1],
[1,0,0,0,0,0,0,0,0,1],
[1,1,1,1,1,1,1,1,1,1]];
function drawTile(x,y,type) {
switch(type) {
case 'floor':
id = "floor";
break;
case 'wall':
id = "wall";
break;
case 'char':
id = "chars";
break;
}
document.write('<div id="'+id+'" style="position:absolute;top:'+x*100+';left:'+y*100+';"></div>');
}
function showMap(map) {
for(var y = 0; y<map.length; y++) {
for(var x = 0; x<map[0].length; x++) {
if(map[y][x] == 0) {
drawTile(x, y, "floor");
}
if(map[y][x] == 1) {
drawTile(x, y, "wall");
}
if(map[y][x] == 2) {
drawTile(x, y, "char");
}
}
}
}
showMap();
</script>
danke im vorruas für hilfe.