scoreboard.resetTimer();
scoreboard.score(0);
scoreboard.clearMessage();
updateCamera();
camera.lookAt(new THREE.Vector3(start.y, 0, 0));
resetItems(river, scoreboard);
paused = false;
}
function updateCamera() {
camera.position.set(
raft.position.x + 75,
raft.position.y + 40,
raft.position.z
);
}
function resetItems(ground, scoreboard) {
removeItems();
addItems(ground, scoreboard);
}
function removeItems() {
game_items.forEach(function(item) {
scene.remove(item);
});
game_items = [];
}
function addItems(ground, scoreboard) {
var points = ground.river_points;
var random20 = Math.floor(20 + 10*Math.random()),
fruit20 = addFruitPowerUp(points[random20], ground, scoreboard);
game_items.push(fruit20);
var random70 = Math.floor(70 + 10*Math.random()),
fruit70 = addFruitPowerUp(points[random70], ground, scoreboard);
game_items.push(fruit70);
}
function addFruitPowerUp(location, ground, scoreboard) {
var mesh = new Physijs.ConvexMesh(
new THREE.SphereGeometry(10, 25),
new THREE.MeshPhongMaterial({emissive: 0xbbcc00}),
0
);
mesh.receiveShadow = true;
mesh.castShadow = true;
Appendix 1. Project Code • 270
Prepared exclusively for Michael Powell report erratum • discuss