// Cloned by Eoghan Murphy on 4 Nov 2018 from World "One Cube World" by Starter user
// Please leave this clone trail here.
const skycolor = 'LightBlue'; // sky color
const objectsize = 300; // size of object
const startRadius = 1000; // distance from centre we start the camera at
const maxRadius = startRadius * 1000000; // maximum distance from camera we render things
const skycolorObject = new THREE.Color ( skycolor.toLowerCase() );
const MUSICFILE = 'uploads/murphe97/LuisFonsiftDaddyYankeeDe.mp3';
var music = new Audio ( MUSICFILE );
music.loop = true; // loop music forever
music.play();
AB.standardAudioButtons ( music );
function World()
{
// the object is a cube (each dimension equal)
AB.clockTick = 1;
var shape = new THREE.BoxGeometry ( objectsize, objectsize, objectsize );
var theobject;
var newtexture;
var gameClock = 1.0;
this.newRun = function()
{
ABWorld.init3d ( startRadius, maxRadius, skycolorObject );
var mtlLoader = new THREE.MTLLoader();
mtlLoader.setPath("/uploads/murphe97/");
//mtlLoader.setResourcePath("/uploads/murphe97/");
mtlLoader.load("peter.mtl", function(materials){
materials.preload();
var objLoader = new THREE.OBJLoader();
objLoader.setMaterials(materials);
objLoader.setPath("/uploads/murphe97/")
objLoader.load("peter.obj", function(mesh){
mesh.position.set(0,0,0);
mesh.scale.set(250,250,250);
theobject = mesh
ABWorld.scene.add(theobject);
});
});
var light = new THREE.DirectionalLight( 0xffffff, 1 );
light.position.set( 10, 10, 10 );
ABWorld.scene.add( light );
var newlight = new THREE.DirectionalLight( 0xffffff, 1 );
newlight.position.set( -10, -10, -10 );
ABWorld.scene.add( newlight );
};
this.nextStep = function()
{
AB.maxSteps += 1
gameClock = gameClock + 0.01;
theobject.position.x = 100 * Math.sin(gameClock);
theobject.position.y = 50 * Math.sin(gameClock);
theobject.position.z = 20 * Math.sin(gameClock);
theobject.rotation.y -= 0.001;
//AB.newSplash ( Math.sin(gameClock));
};
}