Game multi

- Add score board box
    - Implement scoring evolution on board
    - Add a recreat method while goal
    - Start to implement goal animation (not working)
    - Add temporary imput 'l' and 'k' to increment player score
This commit is contained in:
hubourge
2024-09-18 19:06:42 +02:00
parent a93e713f44
commit 7e24946140
4 changed files with 187 additions and 34 deletions

View File

@ -46,6 +46,7 @@ import * as THREE from '/static/javascript/three/build/three.module.js'
let playerExist = false;
let isOnPointAnim = false;
let pressedButton = [];
let mapLength = 0;
class Player
{
@ -70,6 +71,7 @@ class Player
this.limits = map.playerLimits;
this.camera = new THREE.PerspectiveCamera(60, window.innerWidth / window.innerHeight, 0.1, 10000);
this.object.position.set(0, this.limits.down, map.mapLength / 2 - 0.2);
mapLength = map.mapLength;
this.setCameraPosition(
this.object.position.x,
this.object.position.y + 0.7,
@ -92,6 +94,20 @@ class Player
clearInterval(interval);
}
resetPosPlayer()
{
this.object.position.set(0, this.limits.down, mapLength / 2 - 0.2);
}
reserCameraPlayer()
{
this.setCameraPosition(
this.object.position.x,
this.object.position.y + 0.7,
this.object.position.z + 1.5
);
}
pointAnimation(map)
{
const tmpCamera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.1, 10000);