Jump to content

Input not reactivating on mobile


Tesserato
 Share

Recommended Posts

Hello GameDevs,

I am doing a turn-based board game as a college project for both desktop and mobile browsers using PhaserJS framework. However I have ran into a problem regarding the input on mobile. Here's a part of my code:

function move (sprite){
    //disabling input so the user can't interrupt the moving sprite
    game.input.enabled = false;
    
   
    
    //move the selected sprite to a blue tile
    game.physics.arcade.moveToObject(spriteSelecionado,sprite,60,600);
    
    //function to stop the sprite from moving permanently
    game.time.events.add(600, function () {
        
        
        //stops the sprite
        spriteSelecionado.body.velocity.x = 0;
        spriteSelecionado.body.velocity.y = 0;
        
        //clean the tiles used for moving the sprite
        movimentacao.callAll('kill');          
        



        /*This is where the problem resides. While on desktop browers it works just fine,
          the line above doesn't re-enable the input on mobile after a couple times it is used */
        game.input.enabled = true;
    }, this);
   
}

I am currently disabling all the input while the moving sprite hasn't reached its destination so the player doesn't end up clicking midway on it and screwing up the game animations. After the turn ends, I reactivate the input so game continues. The problem is that this just works twice on mobile, If I try to move the game sprites twice all my Input  stops responding. (if I click on the console whi

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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