Code viewer for World: One Cube World (Three.js) ...

// Cloned by Adrian Irwin on 11 Nov 2022 from World "One Cube World (Three.js)" by Starter user 
// Please leave this clone trail here.
 

const MUSICFILE = '/uploads/starter/SuspenseStrings.mp3';
AB.backgroundMusic ( MUSICFILE );


const skycolor          = 'lightblue';           
// const boxcolor          = 'white';
const boxcolor          = '#bbbbbb';

const objectsize    = 300;                  // size of object   

const startRadius   = 1000;                 // distance from centre we start the camera at

const maxRadius     = startRadius * 100;     // maximum distance from camera we render things 

// the object is a cube (each dimension equal): 
  
const shape       = new THREE.BoxGeometry ( objectsize, 50, objectsize );
const material    = new THREE.MeshBasicMaterial ( { color: boxcolor.toLowerCase() } );
const theobject   = new THREE.Mesh ( shape, material );

const boardSize = 1000
const boardShape = new THREE.BoxGeometry (boardSize, 50, boardSize)
const boardMaterial = new THREE.MeshBasicMaterial ( { color: boxcolor.toLowerCase() } );
const board = new THREE.Mesh ( boardShape, boardMaterial );

const boardEdges = new THREE.EdgesGeometry( boardShape );
const boardLine = new THREE.LineSegments( boardEdges, new THREE.LineBasicMaterial( { color: "black" } ) );


// Define what the World does at the start of a run: 

AB.world.newRun = function() 
{
    // start a 3D scene: 
    ABWorld.init3d ( startRadius, maxRadius, skycolor ); 

    // add the object to the scene:
    ABWorld.scene.add ( theobject );
    ABWorld.scene.add (board);
    ABWorld.scene.add (boardLine);
    boardLine.position.y = board.position.y = board.position.y - 100;
    
    const textureFile = '/uploads/adrian28/shrek.jpg';
    let loader = new THREE.TextureLoader();
    
    loader.load (textureFile, function(theTexture) {
        theTexture.minFilter = THREE.LinearFilter;
        theobject.material = new THREE.MeshBasicMaterial({map:theTexture});
    });
};

AB.world.nextStep = function() {
    // theobject.position.x = theobject.position.x + AB.randomIntAtoB(-30, 30);
    // theobject.position.y = theobject.position.y + AB.randomIntAtoB(-30, 30);
    // theobject.position.z = theobject.position.z + AB.randomIntAtoB(-30, 30);
    // theobject.position.x = theobject.position.x + 2;
};