clintgh

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

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();      }}

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.