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

// Cloned by John Lasis on 5 Dec 2022 from World "One Cube World (Three.js)" by Starter user 
// Please leave this clone trail here.
 

const SKYBOX_ARRAY = [										 
                "/uploads/starter/posx.jpg",
                "/uploads/starter/negx.jpg",
                "/uploads/starter/posy.jpg",
                "/uploads/starter/negy.jpg",
                "/uploads/starter/posz.jpg",
                "/uploads/starter/negz.jpg"
                ];          



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

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


const gridsize = 9;					// number of squares along side of world	   
const squaresize = 100;					// size of square in pixels
const MAXPOS = gridsize * squaresize;
  


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

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

    
	var GRID 	= new Array(gridsize);			// can query GRID about whether squares are occupied, will in fact be initialised as a 2D array   
	var WALLS 	= new Array ( 4 * gridsize );		// need to keep handle to each wall block object so can find it later to paint it
	var VALUES = new Array (64); 
	var self = this;

	function translate ( x ) 
	{
		return ( x - ( MAXPOS/2 ) );
	}
    
    ABWorld.scene.background = new THREE.CubeTextureLoader().load ( SKYBOX_ARRAY,	function() // render background image
	 { 
		ABWorld.render(); 
		AB.removeLoading();
		AB.runReady = true; 		
	 });

};