Giuoco Posted December 3, 2015 Share Posted December 3, 2015 Hello! (first time post for me...) I have inconsistent performance with onTap. About 1 in 10 "taps" my player doesn't "jump". How can I isolate if this is a physics problem, an event problem, or maybe a <div> blocking the tap? I'm having a hard time debugging the intermittent problem since it only happens 1 out of 10 or 15 taps. in my create Function I have: game.input.onTap.add(this.onTapLvl1, this);my onTapLvl1 callback is this: doubleJumpBool: false, onTapLvl1: function (thisPlayer, doubleTap) { //check to make sure hoppy isn't hurt if(this.player!=null) { //check to see if hoppy is on the ground if(this.player.body.touching.down) { this.jumpAudio.play(); this.doubleJumpBool = true; this.player.body.velocity.y = -350; } //check to see if we will allow a double jump if(!this.player.body.touching.down && this.doubleJumpBool) { this.jumpAudio.play(); this.player.body.velocity.y += -200; this.doubleJumpBool = false; } } }, Thanks! Link to comment Share on other sites More sharing options...
drhayes Posted December 3, 2015 Share Posted December 3, 2015 At the start of the onTapLvl1 function, put a "console.log" and watch your dev console. If it logs every time you hit the button then you've got a physics problem of some kind. Past that, I'm less sure about the problem. Link to comment Share on other sites More sharing options...
Giuoco Posted December 3, 2015 Author Share Posted December 3, 2015 good advice! I added a console.log and clicked away... found that the onTapLvl1 function isn't getting called when the problem happens. any way I can catch the onTap even in the console? maybe the framework isn't firing the callback? Link to comment Share on other sites More sharing options...
Giuoco Posted December 4, 2015 Author Share Posted December 4, 2015 Question: Does game.input.onTap.add() get reset on state changes? I'm add it to the game on every state change (menu, lvl1, menu, lvl2 etc...). there could easily be 4 or 5 on tap signals added to the game? Link to comment Share on other sites More sharing options...
Recommended Posts