dont stop on escaped
This commit is contained in:
parent
df0ea317de
commit
780252e392
12
main.js
12
main.js
@ -83,6 +83,7 @@ let showStats = window.location.search.includes("stats")
|
|||||||
const ambiance = new Audio("snd/ambiance.mp3")
|
const ambiance = new Audio("snd/ambiance.mp3")
|
||||||
ambiance.loop = true
|
ambiance.loop = true
|
||||||
const piano = new Audio("snd/waves-and-tears.mp3")
|
const piano = new Audio("snd/waves-and-tears.mp3")
|
||||||
|
piano.loop = false
|
||||||
|
|
||||||
const loadMngr = new THREE.LoadingManager();
|
const loadMngr = new THREE.LoadingManager();
|
||||||
const loader = new THREE.TextureLoader(loadMngr);
|
const loader = new THREE.TextureLoader(loadMngr);
|
||||||
@ -390,7 +391,7 @@ const playerDirection = new THREE.Vector3();
|
|||||||
|
|
||||||
let playerOnFloor = false;
|
let playerOnFloor = false;
|
||||||
let jumping = false;
|
let jumping = false;
|
||||||
let stopAnimation = false;
|
let escaped = false;
|
||||||
|
|
||||||
const keyStates = {};
|
const keyStates = {};
|
||||||
|
|
||||||
@ -447,7 +448,7 @@ function onWindowResize() {
|
|||||||
|
|
||||||
function playerCollisions() {
|
function playerCollisions() {
|
||||||
|
|
||||||
if ( !stopAnimation && raftOctree.capsuleIntersect( playerCollider ) ) {
|
if ( !escaped && raftOctree.capsuleIntersect( playerCollider ) ) {
|
||||||
|
|
||||||
message.className = "escaped";
|
message.className = "escaped";
|
||||||
piano.play();
|
piano.play();
|
||||||
@ -476,9 +477,9 @@ function playerCollisions() {
|
|||||||
|
|
||||||
addEventListener("animationend", (event) => {
|
addEventListener("animationend", (event) => {
|
||||||
|
|
||||||
stopAnimation = true;
|
escaped = true;
|
||||||
clearInterval( updateSunIntervalId );
|
clearInterval( updateSunIntervalId );
|
||||||
document.exitPointerLock();
|
//document.exitPointerLock();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -579,6 +580,7 @@ function teleportPlayerIfOob() {
|
|||||||
playerCollider.radius = 0.3;
|
playerCollider.radius = 0.3;
|
||||||
camera.position.copy( playerCollider.end );
|
camera.position.copy( playerCollider.end );
|
||||||
camera.rotation.set( 0, 0, 0 );
|
camera.rotation.set( 0, 0, 0 );
|
||||||
|
message.className= ""
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -630,6 +632,6 @@ function animate() {
|
|||||||
|
|
||||||
if ( showStats ) stats.update();
|
if ( showStats ) stats.update();
|
||||||
|
|
||||||
if ( !stopAnimation ) requestAnimationFrame( animate );
|
requestAnimationFrame( animate );
|
||||||
|
|
||||||
}
|
}
|
@ -38,10 +38,9 @@ body {
|
|||||||
color: gray;
|
color: gray;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
animation: escaped 5s;
|
animation: escaped 5s;
|
||||||
height: 50vh;
|
height: 60vh;
|
||||||
padding-top: 50vh;
|
padding-top: 40vh;
|
||||||
opacity: 100%;
|
opacity: 100%;
|
||||||
background: white;
|
|
||||||
cursor: default;
|
cursor: default;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user