Im trying to draw tiles to a canvas i even followed a tutorial, i made sure the images are in the same directory and i just cant see why this isnt working its exactly like the tutorial. can someone please see the error im failing to see, its driving me up the wall.
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>
RPG
</title>
<link rel="stylesheet" type="text/css" href="main.css">
<!--<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.0.min.js"> </script>
<script type="text/javascript" src="main.js"></script>-->
</head>
<body>
<canvas id="canvas" height="900px" width="900px"></canvas>
<script>
var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');
var map_array = [
[0,0,0,0,0,0,0,0,1,1,0,0],
[0,0,0,0,0,0,0,0,1,1,0,0],
[0,0,0,0,0,0,0,0,1,1,0,0],
[0,0,0,0,0,0,0,0,1,1,0,0],
[0,0,0,0,0,0,0,0,1,1,0,0],
[0,0,0,0,0,0,0,0,1,1,0,0],
[0,0,0,0,0,0,0,0,1,1,0,0],
[0,0,0,1,1,1,1,1,1,1,0,0],
[0,0,0,1,1,1,1,1,1,1,0,0],
[0,0,0,1,1,0,0,0,1,1,0,0],
[0,0,0,1,1,0,0,0,1,1,0,0],
[0,0,0,1,1,0,0,0,1,1,0,0]
];
var grass=new Image();
var dirt=new Image();
grass.src='grass.png';
dirt.src='dirt.png';
var posX = 0;
var posY = 0;
for(i = 0; i < map_array.length; i++){
for(j = 0; j < map_array[i].length; j++){
if(map_array[i][j] == 0){
context.drawImage(grass, posX, posY, 75,75);
}
if(map_array[i][j] == 1){
context.drawImage(dirt, posX, posY, 75,75);
}
posX+=75;
}
posX = 0;
posY+=75;
}
</script>
</body>
</html>