- Update player class (all info in player.js in comment)
This commit is contained in:
Kum1ta
2024-08-19 23:57:19 +02:00
parent 227327fdf4
commit 6eb00a8fdf
9 changed files with 146 additions and 42 deletions

View File

@ -6,7 +6,7 @@
/* By: edbernar <edbernar@student.42angouleme. +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/18 00:53:53 by edbernar #+# #+# */
/* Updated: 2024/08/19 00:37:34 by edbernar ### ########.fr */
/* Updated: 2024/08/19 23:08:38 by edbernar ### ########.fr */
/* */
/* ************************************************************************** */
@ -42,17 +42,24 @@ function createMap()
const scene = new THREE.Scene();
const bar = createBarPlayer(0xed56ea);
const renderer = new THREE.WebGLRenderer();
const player = new Player(bar, renderer);
const spotLight = new THREE.SpotLight(0xffffff, 1000, 0, Math.PI / 4);
const renderer = new THREE.WebGLRenderer({antialias: true});
const player = new Player(bar);
const spotLight = new THREE.SpotLight(0xffffff, 10000, 0, Math.PI / 4);
const ambiantLight = new THREE.AmbientLight(0xffffff, 1);
const map = createMap();
scene.add(player.object);
scene.add(ambiantLight);
spotLight.position.set(0, 100, 0);
scene.add(spotLight);
scene.add(map);
scene.background = new THREE.Color(0x1a1a1a);
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
player.setCameraPosition(0, 0.5, 1)
document.addEventListener('keypress', (e) => {
if (e.key == 'g')
player.pointAnimation(scene);
})
renderer.setAnimationLoop(loop)