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

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.

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.


  • Recently Browsing   0 members

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