game1
by Millieyan
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/84/three.min.js">
</script>
<script src="https://threejs.org/examples/js/controls/OrbitControls.js">
</script>
CSS
body {
overflow: hidden;
}
JavaScript
var renderer, scene, camera, controls;
init();
animate();
function CreateDoor() {
var met = new THREE.MeshNormalMaterial();
var boxGeometry = new THREE.BoxGeometry(10, 10, 65);
var box = new THREE.Mesh(boxGeometry, new THREE.MeshBasicMaterial({
color:0x704214}));
var boxGeometry2 = new THREE.BoxGeometry(10, 15, 50);
var box2 = new THREE.Mesh(boxGeometry2, new THREE.MeshBasicMaterial({
color:0x704214}));
var boxGeometry3 = new THREE.BoxGeometry(10, 15, 50);
var box3 = new THREE.Mesh(boxGeometry3, new THREE.MeshBasicMaterial({
color:0x704214}));
box.position.y = 50;
box.rotation.y = Math.PI / 2;
box.position.z = 250;
box2.rotation.x = Math.PI / 2;
box2.rotation.z = Math.PI / 2;
box2.position.y = 25;
box2.position.z = 250;
box2.position.x = 25;
box3.rotation.x = Math.PI / 2;
box3.rotation.z = Math.PI / 2;
box3.position.y = 25;
box3.position.z = 250;
box3.position.x = -25;
var door = new THREE.Object3D();
door.add(box, box2, box3);
return door;
}
function CreateTree() {
var met = new THREE.MeshNormalMaterial();
var cylinderGeometry = new THREE.CylinderGeometry(3,3,15,40,30);
var box = new THREE.Mesh(cylinderGeometry,new THREE.MeshBasicMaterial({color: 0X5E2612} ));
box.position.y = 7.5;
var sphereGeometry=new THREE.SphereGeometry(3,32,32,6,6.3,6,6.3);
var circle=new THREE.Mesh(sphereGeometry,new THREE.MeshBasicMaterial({color: 0X034139} ));
circle.position.y=22;
var sphereGeometry2=new THREE.SphereGeometry(3,32,32,6,6.3,6,6.3);
var circle2=new THREE.Mesh(sphereGeometry2,new THREE.MeshBasicMaterial({color: 0X034139} ));
circle2.position.x=3;
circle2.position.y=16;
var sphereGeometry3=new THREE.SphereGeometry(3,32,32,6,6.3,6,6.3);
var circle3=new THREE.Mesh(sphereGeometry2,new THREE.MeshBasicMaterial({color: 0X73B839} ));
circle3.position.x=-3;
circle3.position.y=16;
var sphereGeometry4=new THREE.SphereGeometry(3,32,32,6,6.3,6,6.3);
var circle4=new...