Jump to content

Touch pointer issues when offscreen


amathlog
 Share

Recommended Posts

Hi guys !

 

We're currently try to make a game with Phaser and it's just awesome !

 

But I have an issue right there with the Touch pointers (and Buttons).

 

My problem is when you put your finger on the screen, the pointer is declared active. But if you slide outside the screen(keep the finger on the screen but go outside the game screen), your pointer is still active. And you cannot unable it (if you touch the screen again, it's the second pointer which is detected).

 

And this is the issue, because i wanted to create buttons on the bottom of the screen but if you touch the screen too close from the edges, the character would not stop moving (if the button is a direction button).

 

I tried first with buttons and not pointers, and it's the same issue. Altough, if you click on the button again, it resets the button and the character stop moving. But we cannot let the character moving across the map if nothing is touched on the screen.

 

I tried something like this to solve this issue, but if you move too fast it doesn't work. (Game screen is 800*600)

if(PhaserGame.game.input.pointer1.active && PhaserGame.game.input.pointer1.y <= 595){            //alert(PhaserGame.game.input.pointer1.y);            if(PhaserGame.game.input.pointer1.x > 25 && PhaserGame.game.input.pointer1.x < 125){                Player.moveLeft = true;                Player.moveRight = false;            } else if(PhaserGame.game.input.pointer1.x >= 125 && PhaserGame.game.input.pointer1.x < 225){                Player.moveLeft = false;                Player.moveRight = true;            } else {                Player.moveLeft = false;                Player.moveRight = false;                PhaserGame.game.input.pointer1.reset();            }        } else {            Player.moveLeft = false;            Player.moveRight = false;            PhaserGame.game.input.pointer1.reset();        }

Thank you in advance for your answer !

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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