var mapNum = 1;
var gBlocks;
function setup(){
var myCanvas = createCanvas(300, 300);
myCanvas.parent('myContainer');
gBlocks = new Group();
maps = [];
//maps.push([]);
maps.unshift([],[
[1,1,1,1,1,1,1,1,1,1],
[1,1,0,0,0,0,0,0,0,1],
[1,1,0,0,0,0,0,0,0,1],
[1,1,0,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,1,1,1,1,1,1,1,1,1],
]);
for(i = 0; i < maps[mapNum].length; i++){
for(j = 0; j < maps[mapNum][i].length; j++){
if(maps[mapNum][i][j] === 1){
var block = createSprite(j * 30 +15, i * 30 +15, 30, 30)
gBlocks.add(block);
}
}
}
}
function draw() {
drawSprites();
}
コメントを残す