Page of code:

Although this is not a full page of code, this is most likely the most suitable thing to include as a replacement (if i were to include a whole page of code to accurately show the depth of development then i would want to include my index file which is over 2,000 lines long so i feel that would be to much).

This code is the create moon function that i wrote, this this function i can create a moon with various sizes, masses and positions onto any object that ive already placed in my scene:

function createMoon(moonSize, moonMass, moonX, moonY, moonZ, targetPlanet){
var moonMat = moonVisMaterial[Math.floor(Math.random()*moonVisMaterial.length)];
var m = moonsPlanet.length;
var posX = targetPlanet.position.x;
var posY = targetPlanet.position.y;
var posZ = targetPlanet.position.z;

moonPlanetGeometry = new THREE.SphereGeometry(moonSize, 20, 15);
moonPlanetMaterial = moonMat;
moonPlanetMesh[m] = new THREE.Mesh(moonPlanetGeometry, moonPlanetMaterial);

moonPlanetShape[m] = new CANNON.Sphere(moonSize);
moonsPlanet[m] = new CANNON.RigidBody(moonMass, moonPlanetShape[m]);
moonsPlanet[m].position.set(posX + moonX,posY+moonY,posZ+moonZ);
moonsPlanet[m].linearDamping = 0.0;
//collision filtergroup and maskgroups(who it can collide with)
moonsPlanet[m].collisionFilterGroup = objectsGrp;
moonsPlanet[m].collisionFilterMask = objectsGrp;
moonsPlanet[m].preStep = function(){

//get the vector point from the moon to the planet center
var moonsPlanet_to_planetsMoon = new CANNON.Vec3(targetPlanet.position.x -this.position.x,targetPlanet.position.y-this.position.y,targetPlanet.position.z-this.position.z);

//get distance from planet to moon
//var distance = moonsPlanet_to_planetsMoon.norm();
//force is pointing in the moon-plnaet direction
//Math.pow is to the power of (times the number by its self, however many times the 2nd integer states in this case 2)

moonsPlanet_to_planetsMoon.mult(/*6500/Math.pow(distance,2)*/60, this.force);


I am also going to include my collide function in this post to show a separate area of development that i have coded. The collide function handles everything from avatar scale changes(by calling my tweens) to the removal of the correct objects Cannon.js rigid body and Three.js mesh: 

function colliderFunctions() {
//var p = planets.length;
avatarBody.addEventListener(“collide”, function(e) {

var scaleAmount = e.with.shape.radius / (avatar.scale.x * scaleValue);
if( e.with.shape.radius < newMass){
//for testing
if (ifColisionYet ==false){
scaleAmount = 3.5;
ifColisionYet = true;
scaleAvatarPlus.x = scaleAvatarPlus.y = scaleAvatarPlus.z += scaleAmount;
//new avatar Phys Body
newMass = avRadius * avatar.scale.x;

//remove HitObj Phy

if( e.with == planets[planets.indexOf(e.with)]){
var objHit = planets.indexOf(e.with);
} else if (e.with == planetsMoon[planetsMoon.indexOf(e.with)]){
var objHit = planetsMoon.indexOf(e.with);
} else if (e.with == moonsPlanet[moonsPlanet.indexOf(e.with)]){
var objHit = moonsPlanet.indexOf(e.with);
} else if (e.with == moons2Planet[moons2Planet.indexOf(e.with)]){
var objHit = moons2Planet.indexOf(e.with);
} else if (e.with == mercuryPhysObj){
} else if (e.with == venusPhysObj){
} else if (e.with == earthPhysObj){
} else if (e.with == marsPhysObj){
} else if (e.with == jupiterPhysObj){
} else if (e.with == saturnPhysObj){
} else if (e.with == uranusPhysObj){
} else if (e.with == neptunePhysObj){
} else if (e.with == plutoPhysObj){
} else if (e.with == sunPhysObj){
cosmosCanStart == false
$(“#curtain #loadbar”).fadeIn(2500,function(){});
$(‘#curtain #loadbar #intro’).fadeIn(2500,function(){});
document.getElementById(“intro”).innerHTML = “Congratulations, you conquered the solar system! <br/><br/> Click here to try beat your score, or try on a different difficulty. <br/><br/> You achieved a highscore of: ” + highScore +” in: “+elapsedTime+” secounds <br/> “
$(‘#intro’).css({width: WIDTH, height: HEIGHT}).one(‘click’, function(e) {

} else if( e.with.shape.radius > newMass) {
if ( – lastCollide > 1000){
lives -= 1;
lastCollide =;
scaleAvatarMinus.x = scaleAvatarMinus.y = scaleAvatarMinus.z -= scaleAmount/difficulty;
newMass = avRadius * avatar.scale.x;
if (camStage !== 1 && newMass >= 3.5 && newMass <= 7 ){
camStage = 1;
scaleValue = 35;
avatarLevel = 1200;
if(easy == true){
document.getElementById(“score”).style.color = ‘#47784D’;
} else if (camStage !== 2 && newMass >= 7 && newMass <= 13 ){
camStage = 2;
scaleValue = 20;
avatarLevel = 1500;
if(easy == true){
document.getElementById(“score”).style.color = ‘#B52BBD’;
} else if (camStage !== 3 && newMass >= 13 && newMass <= 17 ){
camStage = 3;
scaleValue = 10;
avatarLevel = 1800;
if(easy == true){
document.getElementById(“score”).style.color = ‘#FFFF19’;
} else if (camStage !== 4 && newMass >= 17 && newMass <= 25 ){
camStage = 4;
scaleValue = 4;
avatarLevel = 2000;
if(easy == true){
document.getElementById(“score”).style.color = ‘#FFFF19’;
} else if (camStage !== 5 && newMass >= 25){
camStage = 5;
scaleValue = 0.5;
avatarLevel = 2500;
if(easy == true){
document.getElementById(“score”).style.color = ‘#FFFF19’;
if(lives <= 0){
controlNodes.lives.innerHTML = lives;
cosmosCanStart == false
$(“#curtain #loadbar”).fadeIn(2500,function(){});
$(‘#curtain #loadbar #intro’).fadeIn(2500,function(){});
document.getElementById(“intro”).innerHTML = “Oh no… You ran out of lives <br/><br/> Click here to try again! <br/><br/> You played for: “+elapsedTime+” secounds <br/>and achieved a highscore of: ” + highScore
$(‘#intro’).css({width: WIDTH, height: HEIGHT}).one(‘click’, function(e) {



None original material:

Within my game i have 4 sounds that i did not create, i sourced these sounds from free online sites such as: and:

The planet texture for my game where also out sourced from the free site:


Name: Andy Joyce

Role:   Physics Consultant

Andy asked me to collaborate on his project, to help him with the physics within Toast the Most. I have done a fair amount of work with physic and enjoy figuring out the maths puzzle that come alongside it so i was happy to lend a helping hand. The main problem that andy faced was with the jump of his character because the character doesnt move but the scene moves behind it this proved to be fairly tricky. After a couple of days of work we managed to write a script to the standard that Andy was happy with.


Name: Louie Babb


Similarly to how Louie contributed to my project, i did the same for his. Considering that we live together we were always around to discuss our projects meaning we could both talk over every aspect of our projects throughout the development processes. Providing second opinions on the work we had produced and our plans for the next stage of development. Keeping each other motivated and encouraging each other to persist with the difficult tasks and long nights ahead of us.


Name: Andy Joyce

Task: Web Design 

Through his time at bournemouth and his career at zeeta andy has had to develop his design skills to a much higher standard than mine. Being a coder through and through i struggle with the motivation to start web design, i am able enough to tell whether something looks good or not but sometimes have a lack of ideas. Andy worked with me over a couple of days on a consultancy basis, whenever i had a problem or was stuck for an idea andy would help me overcome my problem. With his help i was able to produce a web design that looked clean and fitted my project so i am very happy with his support!

Score 5/5


Name: Louie Babb


Me and Louie live together so throughout the course of our project we have both been available to talk over every aspect of concept develop, planning and technical development. Very regularly after a long day and nights coding and development we could visit each others rooms and talk over the days work, showing each other our progress and asking for the others opinions. We would also talk over breakfast of our plans for work for the day and encourage and motivate each other to continue working when either of us had a lack of motivation. Louie has been and invaluable resource throughout my project, i don’t believe that without his second opinion of many aspects of my project, that i would of been able to produce the level of work that i have achieved.

Score 5/5