Jump to content

this.input.activePointer.isDown is not working properly on mobile


clintgh
 Share

Recommended Posts

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

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...