Code viewer for World: New World
class Wall {
  constructor(x, y, w, h, color) {
    this.x = x;
    this.y = y;
    this.w = w;
    this.h = h;
    this.color = color;
  }

  draw() {
    push();
    translate(this.x, this.y, 0);
    fill(this.color);
    noStroke();
    box(this.w, this.h, 1);
    pop();
  }
}

let walls = [];

function setup() {
  createCanvas(400, 400, WEBGL);

  // Create the walls
  walls.push(new Wall(0, 0, 100, 100, color(0, 255, 0))); // Green wall
  walls.push(new Wall(100, 0, 100, 100, color(255, 0, 0))); // Red wall
  walls.push(new Wall(200, 0, 100, 100, color(0, 0, 255))); // Blue wall

  // Enable orbit control
  orbitControl();
}

function draw() {
  background(255);

  // Draw the floor
  fill(255);
  noStroke();
  plane(300, 300, 0, 0, 0);

  // Draw the roof
  fill(128);
  noStroke();
  plane(300, 300, 0, 1, 0);

  // Draw the walls
  for (let i = 0; i < walls.length; i++) {
    walls[i].draw();
  }
}