Okay I'm creating a tilebased engine for a game I'm creating and anyways here's the script in action:
http://www.cyberpunkgame.0nyx.com/mapmaker.html
here's what I have :
<html>
<head>
<title>Map builder</title>
<script type="text/javascript">
map1=new Array(1,1,1,1,1,1,1,1,1,1,
0,1,1,1,1,1,0,1,1,1,
0,1,1,1,1,1,0,1,1,1,
1,1,1,1,1,1,1,1,1,1);
function createmap(map){
//change row
for(k=0;k<map.length/10;k++){
//across
for(i=0;i<map.length/4;i++){
valuex=18*i;
valuey=18*k;
if(map[i] == 1){
document.write('<img src="block.bmp" style="position:absolute;Left:'+ valuex +';Top:'+ valuey +'">');
}
if(map[i] == 0){
document.write('<img src="other.bmp" style="position:absolute;Left:'+ valuex +';Top:'+ valuey +'">');
}
}
}
}
createmap(map1);
</script>
</head>
<body>
</body>
</html>
And here's my problem other.bmp is red yet I can't get it to build the red blocks I don't know what my problem is. So I figured you js experts could tell me the error in my ways :P.
PS. Thanks ahead of time.



Reply With Quote
.





Bookmarks