mirror of
https://gitlab.com/arnekeller/tunnel-racer.git
synced 2024-11-22 15:04:57 +00:00
Remove set_head button + make it required to start
This commit is contained in:
parent
ecf4c24338
commit
6e8a13dd0d
@ -15,7 +15,7 @@
|
|||||||
<button id="set_head">Calibrate neutral position</button>
|
<button id="set_head">Calibrate neutral position</button>
|
||||||
<p id="log"></p>
|
<p id="log"></p>
|
||||||
</div>
|
</div>
|
||||||
<button id="start">Start</button>
|
<button id="start" disabled>Start</button>
|
||||||
|
|
||||||
<script src="/three.min.js"></script>
|
<script src="/three.min.js"></script>
|
||||||
<script src="/game.js"></script>
|
<script src="/game.js"></script>
|
||||||
|
10
game.js
10
game.js
@ -136,6 +136,8 @@ function init_gn() {
|
|||||||
start_gn();
|
start_gn();
|
||||||
}).catch(function(e) {
|
}).catch(function(e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
|
document.getElementById("set_head").remove();
|
||||||
|
document.getElementById("start").disabled = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
document.addEventListener('keydown', e => {
|
document.addEventListener('keydown', e => {
|
||||||
@ -187,7 +189,9 @@ function set_head_gn() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
document.getElementById("set_head").addEventListener("click", () => {
|
document.getElementById("set_head").addEventListener("click", () => {
|
||||||
|
document.getElementById("set_head").remove();
|
||||||
set_head_gn();
|
set_head_gn();
|
||||||
|
document.getElementById("start").disabled = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
init_gn();
|
init_gn();
|
||||||
@ -252,6 +256,12 @@ init();
|
|||||||
animate();
|
animate();
|
||||||
|
|
||||||
document.getElementById("start").onclick = () => {
|
document.getElementById("start").onclick = () => {
|
||||||
|
try {
|
||||||
|
document.body.requestFullscreen();
|
||||||
|
} catch (e) {
|
||||||
|
// browser doesn't support this API, try another hack
|
||||||
|
window.scrollTo(0,1);
|
||||||
|
}
|
||||||
document.getElementById("start").style.zIndex = -10;
|
document.getElementById("start").style.zIndex = -10;
|
||||||
document.getElementById("start").style.visibility = "hidden";
|
document.getElementById("start").style.visibility = "hidden";
|
||||||
speed = 5.0;
|
speed = 5.0;
|
||||||
|
Loading…
Reference in New Issue
Block a user