Jump to content

Phaser usage on a Windows Tablet - Events not firing


Recommended Posts



I wonder anyone can help.


I have a new Windows 10 tablet so I can start to do touchscreen stuff in Phaser.

But I have a problem insofar as the onInputDown event only fires once I remove my finger from the screen (so onInputUp fires too).


I have the following in Create:

    this.buttonfire = this.add.sprite(500, 250, 'buttonfire');
    this.buttonfire.inputEnabled = true;
    this.buttonfire.events.onInputDown.add(function(){this.fire=true; alert("Down");});
    this.buttonfire.events.onInputUp.add(function(){this.fire=false; alert("Up");});        

When I press the button and keep finger down, nothing happens, but releasing finger fires Down and Up consecutively.


So I tried something else, and I have the following in Update:

    if (this.game_state.input.activePointer.isDown) {
        screenX = this.game.input.activePointer.screenX;
        screenY = this.game.input.activePointer.screenY;
        this.debugText.text = screenX + " " + screenY;

What happens here is that touching the screen does nothing, but dragging my finger give the X and Y appropriately. So nothing on touch, but is triggered if I then move finger.


Am I being daft here?

All help welcome.


Thanks :)

Link to comment
Share on other sites


  • Recently Browsing   0 members

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