// Cloned by Octavian on 24 Oct 2022 from World "One Cube World (Three.js)" by Starter user
// Please leave this clone trail here.
const skycolor = 'lightblue';
const boxcolor = '#DC1403';
const startRadius = 1000; // distance from centre we start the camera at
const maxRadius = startRadius * 10;
const objectsize = 500; // size of object
const otherside = 200;
// maximum distance from camera we render things
const box_array = new Array(15);
// the object is a cube (each dimension equal):
var shape = new THREE.BoxGeometry ( objectsize, otherside, objectsize );
var material = new THREE.MeshBasicMaterial ( { color: boxcolor.toLowerCase() } );
var theobject = new THREE.Mesh ( shape, material );
ABHandler.GROUNDZERO = true;
function makeobj()
{
const texturefile = '/uploads/octa1936/1666610840.png';
var loader = new THREE.TextureLoader();
loader.load ( texturefile, function ( thetexture )
{
thetexture.minFilter = THREE.LinearFilter;
theobject.material = new THREE.MeshBasicMaterial ( { map: thetexture } );
});
theobject.position.x = 0;
theobject.position.z = 0;
theobject.position.y = 0;
ABWorld.scene.add(theobject);
}
const OBJ_HUMAN = '/uploads/starter/skelet.obj';
const TEXTURE_HUMAN = "/uploads/octa1936/Red_Color.jpg";
const SCALE_HUMAN = 7;
var theenemy;
var maze_texture;
function loadResources()
{
var loader = new THREE.OBJLoader ( new THREE.LoadingManager() );
loader.load ( OBJ_HUMAN, function ( object )
{
theenemy = object;
if ( asynchFinished() ) initScene();
});
var loader2 = new THREE.TextureLoader();
loader2.load ( TEXTURE_HUMAN, function ( thetexture )
{
thetexture.minFilter = THREE.LinearFilter;
maze_texture = thetexture;
if ( asynchFinished() ) initScene();
});
}
function asynchFinished()
{
if (maze_texture && theenemy) return true;
else return false;
}
function initScene()
{
theenemy.traverse ( function ( child )
{
if ( child instanceof THREE.Mesh )
child.material.map = maze_texture ;
});
theenemy.scale.multiplyScalar ( SCALE_HUMAN );
var object = theenemy.clone();
object.position.x = 0;
object.position.y = 0;
object.position.z = 0;
ABWorld.scene.add(object);
}
// Define what the World does at the start of a run:
AB.world.newRun = function()
{
// start a 3D scene:
ABWorld.init3d ( startRadius, maxRadius, skycolor );
loadResources();
makeobj();
// add the object to the scene:
};
/* const MUSICFILE = '/uploads/starter/SuspenseStrings.mp3';
AB.backgroundMusic ( MUSICFILE );*/
AB.world.nextStep = function()
{
};