Jump to content

Touch screen problem in Kongregate


onlycape
 Share

Recommended Posts

Hi,

I just uploaded a game made with on Kongregate to its own server (using the option webgl/html5):

https://www.kongregate.com/games/olycape/flappy-tours

In the game I use the onDown event:
game.input.onDown.add (this.myfunction, this);

In the free server where I have it hosted everything works correctly:

http://jjgames.pcriot.com/

The problem is that on touch screens and only on the Kongregate website, raising your finger generates the onDown event. Due to this the control becomes very difficult in touch screens.
From what I see the game is embeded in an iframe from one of its servers.

I would like to avoid the use of onTap, since it is not very agile for this type of game.

Has anyone else had this issue? Any advice?.

Thanks in advance.

Regards.

Link to comment
Share on other sites

Hey,

I haven't had any problems like that so I'm not entirely sure why that happens.

Try adding: game.input.onDown.remove (this.myfunction, this);
at the end of the function (this.myfunction)

If that doesnt work... then

Try adding: game.input.onUp.add (function(){}, this);
below game.input.onDown.add (this.myfunction, this);

Link to comment
Share on other sites

Hi,

Thanks for your answer @3man7 . Using OnUp I was not able to fix the problem.

In the end I found the solution using the monitorEvents() command in the chrome console using the device emulator, to detect the problem.

Here, the events recorded by a tap on the screen:

debugger.png.5f2c136e8d8a7d66304bc54164a35b62.png

There are two events that I imagine that Phaser interprets as onDown events. (on my server the event 'mousedown' didn't appear).

Solution:


//Add the event listener for pointerdown event

game.canvas.addEventListener('pointerdown', MyFunction);


//For remove the event listener

game.canvas.removeEventListener('pointerdown', MyFunction);

I hope this saves time for others with the same problem.

Regards.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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