function init()
{
	scene.add(water);
	scene.add(sky);
	scene.environment = new THREE.PMREMGenerator(renderer).fromScene(sky).texture;
	processInput(boat);

	while (treasures.length < MAX_NUM_TREASURES)
	{
		treasures.push(new Treasure(scene, 100 + Math.random() * 100, 100 + Math.random() * 100));
		treasures.push(new Treasure(scene, -100 - Math.random() * 100, 100 + Math.random() * 100));
		treasures.push(new Treasure(scene, 100 + Math.random() * 100, -100 - Math.random() * 100));
		treasures.push(new Treasure(scene, -100 - Math.random() * 100, -100 - Math.random() * 100));
	}

	while (enemies.length < MAX_NUM_ENEMIES)
	{
		enemies.push(new Enemy(scene, 100 + Math.random() * 50, 100 + Math.random() * 30));
		enemies.push(new Enemy(scene, -100 - Math.random() * 50, 100 + Math.random() * 30));
		enemies.push(new Enemy(scene, 100 + Math.random() * 50, -100 - Math.random() * 30));
	}
}
// init sets up the game, loading bg textures, and the initial objects
init sets up the game, loading bg textures, and the initial objects
init sets up the game loading bg textures and the initial objects
function init()
{
	scene.add(water);
	scene.add(sky);
	scene.environment = new THREE.PMREMGenerator(renderer).fromScene(sky).texture;
	processInput(boat);
	while (treasures.length < MAX_NUM_TREASURES)
	{
		treasures.push(new Treasure(scene, 100 + Math.random() * 100, 100 + Math.random() * 100));
		treasures.push(new Treasure(scene, -100 - Math.random() * 100, 100 + Math.random() * 100));
		treasures.push(new Treasure(scene, 100 + Math.random() * 100, -100 - Math.random() * 100));
		treasures.push(new Treasure(scene, -100 - Math.random() * 100, -100 - Math.random() * 100));
	}
	while (enemies.length < MAX_NUM_ENEMIES)
	{
		enemies.push(new Enemy(scene, 100 + Math.random() * 50, 100 + Math.random() * 30));
		enemies.push(new Enemy(scene, -100 - Math.random() * 50, 100 + Math.random() * 30));
		enemies.push(new Enemy(scene, 100 + Math.random() * 50, -100 - Math.random() * 30));
	}
}
function init ( ) { scene . add ( water ) ; scene . add ( sky ) ; scene . environment = new THREE . PMREMGenerator ( renderer ) . fromScene ( sky ) . texture ; processInput ( boat ) ; while ( treasures . length < MAX_NUM_TREASURES ) { treasures . push ( new Treasure ( scene , 100 + Math . random ( ) * 100 , 100 + Math . random ( ) * 100 ) ) ; treasures . push ( new Treasure ( scene , - 100 - Math . random ( ) * 100 , 100 + Math . random ( ) * 100 ) ) ; treasures . push ( new Treasure ( scene , 100 + Math . random ( ) * 100 , - 100 - Math . random ( ) * 100 ) ) ; treasures . push ( new Treasure ( scene , - 100 - Math . random ( ) * 100 , - 100 - Math . random ( ) * 100 ) ) ; } while ( enemies . length < MAX_NUM_ENEMIES ) { enemies . push ( new Enemy ( scene , 100 + Math . random ( ) * 50 , 100 + Math . random ( ) * 30 ) ) ; enemies . push ( new Enemy ( scene , - 100 - Math . random ( ) * 50 , 100 + Math . random ( ) * 30 ) ) ; enemies . push ( new Enemy ( scene , 100 + Math . random ( ) * 50 , - 100 - Math . random ( ) * 30 ) ) ; } }
init sets up the game, loading bg textures, and the initial objects
init sets up the game loading bg textures and the initial objects