Game solo - Add game start timer during launch
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
/* By: hubourge <hubourge@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/08/28 12:07:39 by edbernar #+# #+# */
|
||||
/* Updated: 2024/09/11 16:12:16 by hubourge ### ########.fr */
|
||||
/* Updated: 2024/09/11 17:14:19 by hubourge ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -57,8 +57,7 @@ class SoloGame
|
||||
Players.create(scene);
|
||||
|
||||
controls = new OrbitControls(camera, renderer.domElement);
|
||||
camera.position.set(0, 30, 0);
|
||||
// camera.position.set(20, 5, 25);
|
||||
camera.position.set(0, 22, 0);
|
||||
|
||||
document.addEventListener('keypress', (e) => {
|
||||
if (e.key == 'a')
|
||||
@ -89,6 +88,7 @@ class SoloGame
|
||||
}
|
||||
scene = null;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function loop()
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: hubourge <hubourge@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/08/28 12:23:48 by edbernar #+# #+# */
|
||||
/* Updated: 2024/09/11 16:10:26 by hubourge ### ########.fr */
|
||||
/* Updated: 2024/09/11 17:19:26 by hubourge ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -128,9 +128,24 @@ class Map
|
||||
initialZ = vec3.z;vec3.x = 3;
|
||||
ballBody.velocity.set(vec3.x, vec3.y, vec3.z);
|
||||
onUpdate = true;
|
||||
|
||||
setTimeout(() => {
|
||||
scoreElement.innerHTML = '3';
|
||||
}, 1000);
|
||||
setTimeout(() => {
|
||||
scoreElement.innerHTML = '2';
|
||||
}, 1750);
|
||||
setTimeout(() => {
|
||||
scoreElement.innerHTML = '1';
|
||||
}, 2500);
|
||||
|
||||
setTimeout(() => {
|
||||
scoreElement.innerHTML = score.player1 + '-' +score.player2;
|
||||
}, 3250);
|
||||
|
||||
setTimeout(() => {
|
||||
onUpdate = false;
|
||||
}, 900);
|
||||
}, 4000);
|
||||
}
|
||||
|
||||
static #collision()
|
||||
@ -244,9 +259,6 @@ class Map
|
||||
if (speed < 7)
|
||||
speed += 0.003;
|
||||
|
||||
// let velocity = Math.sqrt(vec3.x * speed, vec3.y * speed, vec3.z * speed);
|
||||
// console.log("Vitesse du vecteur:", velocity);
|
||||
|
||||
ballBody.velocity.set(vec3.x * speed, vec3.y * speed, vec3.z * speed);
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,6 @@
|
||||
<script src="./main.js" type="module"></script>
|
||||
</head>
|
||||
<body>
|
||||
<p id="score">0 - 0</p>
|
||||
<p id="score"></p>
|
||||
</body>
|
||||
</html>
|
||||
|
Reference in New Issue
Block a user