mirror of
https://gitlab.com/arnekeller/tunnel-racer.git
synced 2024-11-09 01:00:38 +00:00
Fix score counting + obstacle removal
This commit is contained in:
parent
32c91a6ecd
commit
0adc1fe818
4
game.js
4
game.js
@ -376,7 +376,7 @@ function animate() {
|
|||||||
|
|
||||||
|
|
||||||
for (let i = 0; i < cubes.length; i++) {
|
for (let i = 0; i < cubes.length; i++) {
|
||||||
if (cubes[i].position.z > camera.position.z + cubes[i].geometry.parameters.radius * cubes[i].scale.x) {
|
if (cubes[i].position.z > camera.position.z + cubes[i].geometry.parameters.radius * cubes[i].scale.x + 20) {
|
||||||
scene.remove(cubes[i]);
|
scene.remove(cubes[i]);
|
||||||
cubes.splice(i, 1);
|
cubes.splice(i, 1);
|
||||||
i--;
|
i--;
|
||||||
@ -385,7 +385,7 @@ function animate() {
|
|||||||
}
|
}
|
||||||
if (removed >= 2 || score == 0) {
|
if (removed >= 2 || score == 0) {
|
||||||
score += removed / 2;
|
score += removed / 2;
|
||||||
removed = removed % 2;
|
removed = 0;
|
||||||
document.getElementById("score").innerText = score;
|
document.getElementById("score").innerText = score;
|
||||||
}
|
}
|
||||||
if (borders.length == 0 || borders[borders.length - 1].position.z - camera.position.z > -1200) {
|
if (borders.length == 0 || borders[borders.length - 1].position.z - camera.position.z > -1200) {
|
||||||
|
Loading…
Reference in New Issue
Block a user