clintgh Posted March 15, 2015 Share Posted March 15, 2015 I don't know why this is happening but the getGold() function inside the this.input.activePointer.isDown is not working on mobile but working fine on browsers. I compiled the code using cordova/phonegap to put it on mobile. What should happen:player tap and hold on the screen > animation should play > everytime it hits the last frame it should get gold What's happening (browser):player taps and hold on screen > animation plays > everytime it hits the last frame it gets gold What's happening (mobile):player taps and hold on screen > animation plays Code:function update() {if(this.input.activePointer.isDown) { player.animations.play('mine'); var curframe = player.animations.currentAnim.frame; if(curframe == 3) { getGold(function() { var convertedScore = (score / 3.0864716706).toFixed(3); if(convertedScore == 100) { showAlert("CONGRATULATIONS! \nYOU REACHED THE \nGOAL of 100 CARAT!"); } }); }} else { player.animations.stop(); player.frame = 0;}}function getGold(callback) { score = score + (Math.floor(Math.random() * maxgoldpersec) + mingoldpersec); var convertedScore = (score / 3.0864716706).toFixed(3); scoreText.text = "Gold: " + convertedScore + ' carat'; if(callback) { callback(); }} Link to comment Share on other sites More sharing options...
Henryk Posted March 19, 2015 Share Posted March 19, 2015 If have the same problem. You've found a solution? Link to comment Share on other sites More sharing options...
Recommended Posts