From 48fe9b343ee180ca574b161930af13d14059a800 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Wed, 2 Mar 2016 18:20:18 -0800 Subject: [PATCH] Couple trigger value fixes --- examples/flappyBird.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/examples/flappyBird.js b/examples/flappyBird.js index 11bafef313..2820d3afc7 100644 --- a/examples/flappyBird.js +++ b/examples/flappyBird.js @@ -189,13 +189,13 @@ // Game loop setup var timestamp = 0; - this.idle = function() { + this.idle = function(triggerValue) { var now = Date.now(); var deltaTime = (now - timestamp) / 1000.0; if (timestamp === 0) { deltaTime = 0; } - inputs(); + inputs(triggerValue); update(deltaTime); draw(); timestamp = now; @@ -251,8 +251,10 @@ pipes = new Pipes(space.dimensions.x, space.dimensions.y, to3DPosition); } function inputs(triggerValue) { - isJumping = true; - startedPlaying = true; + if (triggerValue > 0.5) { + isJumping = true; + startedPlaying = true; + } } function update(deltaTime) { //print("update: " + deltaTime); @@ -426,8 +428,7 @@ return; } this.triggerValue = Controller.getValue(TRIGGER_CONTROLS[this.hand]); - - this.game.idle(); + this.game.idle(this.triggerValue); }, };