forked from shaunlebron/pacman-mazegen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
many.htm
50 lines (41 loc) · 892 Bytes
/
many.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<!DOCTYPE html>
<html>
<head>
<script src="mapgen.js"></script>
<script src="colors.js"></script>
<script src="Map.js"></script>
</head>
<body>
<p>
<button onclick="draw()">Click to generate new maps</button>
</p>
<canvas id='canvas'></canvas>
<script>
var draw = function() {
var canvas = document.getElementById('canvas');
var rows = 4;
var cols = 4;
var w,h;
w = 28*8;
h = 36*8;
canvas.width = w*cols;
canvas.height = h*rows;
var ctx = canvas.getContext('2d');
var map;
var x,y;
for (y=0; y<rows; y++) {
for (x=0; x<cols; x++) {
map = mapgen();
map.draw(ctx,x*w,y*h);
}
}
//drawResult(ctx,(cols+2)*size,size,size);
//drawResult2(ctx,(2*cols+3)*size,size,size);
//drawTiles(ctx,(cols+2)*size,size,size);
};
window.onload = function() {
draw();
};
</script>
</body>
</html>