xxxxxxxxxx
67
let imgs;
const BLOCK = 0;
function preload(){
imgs = [];
imgs[BLOCK]=loadImage("assets/block.png");
}
class Square {
constructor(x,y,height) {
}
}
let screens = [
[
new Square(0,2,2)
]
];
let currScreen = 0;
const SCALE = 150;
const w = SCALE*4;
const h = SCALE*3;
let SIZE = w*h;
let gridScale=3;
let gridWidth=gridScale*4;
let gridHeight = gridScale*3;
let gridSize = gridHeight*gridWidth;
const sqSize = w/gridWidth;
function setup() {
for (let i=0;i<imgs.length;i++) {
imgs[i].loadPixels();
}
createCanvas(w, h);
console.log(gridWidth,gridHeight);
// let s = screens[currScreen]
// for (let y=0;y<gridHeight;y++){
// for (let x=0;x<gridWidth;x++) {
// // image(imgs[BLOCK],x,y,1,1);
// console.log(x,y)
// }
// }
noLoop();
}
function draw() {
background(220);
noSmooth();
// for (let i=0;i<map.length;i++) {
// }
// image(imgs[BLOCK],0,0,256,256);
let s = screens[currScreen]
for (let y=0;y<height;y+=sqSize){
for (let x=0;x<width;x+=sqSize) {
image(imgs[BLOCK],x,y,sqSize,sqSize);
}
}
for (let i=0;i<s.length;i++) {
}
}