xxxxxxxxxx
24
class Block {
constructor(x, y, type) {
this.pos = createVector(x * scl, y * scl);
this.type = type;
}
show() {
push();
if (this.type == blockTypes.GRASS) {
image(blockImgs.GRASS, this.pos.x, this.pos.y, scl, scl);
} else if (this.type == blockTypes.DIRT) {
image(blockImgs.DIRT, this.pos.x, this.pos.y, scl, scl);
} else if (this.type == blockTypes.STONE) {
image(blockImgs.STONE, this.pos.x, this.pos.y, scl, scl);
} else if (this.type == blockTypes.OAK_WOOD) {
image(blockImgs.OAK_WOOD, this.pos.x, this.pos.y, scl, scl);
} else if (this.type == blockTypes.OAK_LEAVES) {
image(blockImgs.OAK_LEAVES, this.pos.x, this.pos.y, scl, scl);
} else if (this.type === blockTypes.COAL_ORE) {
image(blockImgs.COAL_ORE, this.pos.x, this.pos.y, scl, scl);
}
pop();
}
}