Code viewer for World: Daylight is my enemy
var img;

function preload()
{
    the_fox = loadImage ( "/uploads/robjj80/klee.jpg");
     moon_texture = loadImage ( "/uploads/robjj80/moon_texture.jpg");
    // https://ancientbrain.com/uploads/robjj80/klee.jpg
}



//function preload() {
 // moon_texture = loadImage ( "/uploads/robjj80/moon_texture.jpg");
//}

//rob();

const noboxes = 1;
var a = new Array(noboxes);


for (var i=0; i < noboxes; i++)
{
    a[i] = [ AB.randomIntAtoB(-500,500), AB.randomIntAtoB(-500,500), AB.randomIntAtoB(-500,500) ];
}

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

//Add music
const MUSICFILE = '/uploads/robjj80/lost-in-trance-Pixabay.mp3';
//Royalty free track downloaded at https://pixabay.com/music/search/genre/techno%20&%20trance/ (Oct 2021)

AB.backgroundMusic (MUSICFILE);

// Cloned by Robert Joscelyne on 7 Oct 2021 from World "One Cube World (P5)" by Starter user 
// Please leave this clone trail here.
 
 
const objectsize    = 300;      // size of object   
const anglechange   = 0.01;     // how much the rotate angle changes each step 
var angle = 0;                  // rotate angle starts at 0  


function setup()        // "setup" is called once at start of run 
{
  createCanvas ( ABWorld.fullwidth(), ABWorld.fullheight(),  WEBGL );
}

function draw()         // "draw" is called every timestep during run 
{
  background("black");
  
  let locX = mouseX - height / 2;
  let locY = mouseY - width / 2;

  ambientLight(100);
  directionalLight(255, 0, 0, 0.25, 0.25, 0);
  pointLight(0, 0, 255, locX, locY, 250);
  translate(width / 17, 0, 0);
  texture(moon_texture);
  sphere(180,120);

  texture(the_fox);
  rotateX(angle);             // set each dimension rotation angle to "angle"
  rotateY(angle);
  rotateZ(angle);
  
    for ( var i=0; i < noboxes; i++)
    {
        translate ( a[i][0], a[i][1], a[i][2] );
        box(objectsize);
    }
  
    box(objectsize);            // draw a cube of this size 
  
    angle = angle + anglechange ;       // change angle each step to get rotate movement

    
 
}