diff --git a/ff0fsum4zx.js b/ff0fsum4zx.js index 32694db..2fd2cf5 100644 --- a/ff0fsum4zx.js +++ b/ff0fsum4zx.js @@ -75,6 +75,8 @@ this.totalTime = R3.CustomCode.TIME_LIMIT; this.score = 0; +this.secondCounter = 0; + this.ballY = this.football.instance.geometry.boundingSphere.radius / 2; if (this.debug) { @@ -90,6 +92,18 @@ R3.CustomCode.prototype.render = function(delta) { this.totalTime -= delta; + this.secondCounter += delta; + if (this.secondCounter >= 1) { + this.secondCounter -= 1; + R3.Event.Emit( + R3.Event.GAME_DATA, + { + type : 'timer', + time : Math.round(this.totalTime) + } + ) + } + if (this.totalTime <= 0) { this.totalTime = 0; @@ -447,16 +461,11 @@ R3.Event.Subscribe( } ); - setTimeout( - function() { - R3.Event.Emit( - R3.Event.STOP_AUDIO, - { - name : 'Audio - Crowd' - } - ); - }, - 1500 + R3.Event.Emit( + R3.Event.STOP_AUDIO, + { + name : 'Audio - Crowd' + } ); this.mouseMove.entityLoaded = null; @@ -501,8 +510,18 @@ R3.Event.Subscribe( this.score = 0; + this.secondCounter = 0; + this.totalTime = R3.CustomCode.TIME_LIMIT; + R3.Event.Emit( + R3.Event.GAME_DATA, + { + type : 'timer', + time : this.totalTime + } + ); + this.balls.map( function(ball) {