const gridsize = 30; // number of squares along side of world
const squaresize = 100; // size of square in pixels
const MAXPOS = gridsize * squaresize; // length of one side in pixels
const NOBOXES = Math.trunc ( (gridsize * gridsize) / 15 );
const SKYCOLOR = 0xffffcc; // a number, not a string
const LIGHTCOLOR = 0xffffff ;
const startRadiusConst = MAXPOS * 0.8 ; // distance from centre to start the camera at
const maxRadiusConst = MAXPOS * 5 ;
ABHandler.MAXCAMERAPOS = maxRadiusConst ;
ABHandler.GROUNDZERO = true;
const SKYBOX_ARRAY = [
"/uploads/mchenrp2/skyrender0001.png",
"/uploads/mchenrp2/skyrender0004.png",
"/uploads/mchenrp2/skyrender0003.png",
"/uploads/mchenrp2/skyrender0006.png",
"/uploads/mchenrp2/skyrender0005.png",
"/uploads/mchenrp2/skyrender0002.png"
];
function initScene() // all file loads have returned
{
ABWorld.scene.background = new THREE.CubeTextureLoader().load ( SKYBOX_ARRAY, function()
{
ABWorld.render();
AB.removeLoading();
AB.runReady = true;
});
}
AB.world.newRun = function()
{
// Code for Three.js initial drawing of objects.
// Should include one of:
// ABWorld.init2d ( arguments );
// ABWorld.init3d ( arguments );
ABWorld.init3d ( startRadiusConst, maxRadiusConst, SKYCOLOR );
loadResources(); // aynch file loads
// calls initScene() when it returns
};
AB.world.nextStep = function()
{
// Code for Three.js re-drawing of objects.
};
AB.world.endRun = function()
{
};
AB.world.newRun = function()
{
AB.loadingScreen();
AB.runReady = false;
badsteps = 0;
goodsteps = 0;
ABWorld.init3d ( startRadiusConst, maxRadiusConst, SKYCOLOR );
loadResources(); // aynch file loads
// calls initScene() when it returns
// light
var ambient = new THREE.AmbientLight();
ABWorld.scene.add( ambient );
var thelight = new THREE.DirectionalLight ( LIGHTCOLOR, 3 );
thelight.position.set ( startRadiusConst, startRadiusConst, startRadiusConst );
ABWorld.scene.add(thelight);
};
/*
AB.world.getState = function()
{
var x = [ ai, aj, ei, ej ];
return ( x );
};
AB.world.takeAction = function ( a )
{
moveLogicalAgent(a);
if ( ( AB.step % 2 ) == 0 ) // slow the enemy down to every nth step
moveLogicalEnemy();
if ( badstep() ) badsteps++;
else goodsteps++;
drawAgent();
drawEnemy();
updateStatus();
};
*/