Jump to content

Click on sprite reflect on things under it


Recommended Posts

It seems you are using game.input.onDown for your tilemap clicking, and sprite.events.onInputDown for your sprite clicking.  That, or Phaser internally uses game.input.onDown for the tilemap click detection.  

Either way, you should be able to stop the sprite.events.onInputDown from propagating down to the tilemap with this method.

Link to comment
Share on other sites

Right, the technique should still be the same.  You want to put an invisible sprite directly under your button (and over the tilemap) with the same x,y,height, and width as that button.  Then, configure it to "eat" the input from game.input.onDown so the tilemap never sees it.

Link to comment
Share on other sites


After try a lot of thing...no success. I updated to phaser 2.4.7, but the problem still.

Look the image:



My code:

context.map.priorityID = ; // HERE


var buttonAddBombW = game.cache.getImage('buttonAddBomb').width;
var buttonAddBombH = game.cache.getImage('buttonAddBomb').height;
var buttonAddBombX = game.camera.x;
var buttonAddBombY = game.camera.height - buttonAddBombH;

context.buttonAddBombBG = game.add.sprite(buttonAddBombX, buttonAddBombY, 'connectionState');
context.buttonAddBombBG.fixedToCamera = true;
context.buttonAddBombBG.width = buttonAddBombW;
context.buttonAddBombBG.height = buttonAddBombH;
context.buttonAddBombBG.inputEnabled = true;
context.buttonAddBombBG.input.priorityID = 1; // HERE
context.buttonAddBombBG.tint = 0xFF0000;
context.buttonAddBombBG.backgroundColor = 0xFF0000;

context.buttonAddBomb = game.add.button(buttonAddBombX, buttonAddBombY, 'buttonAddBomb', function () {
    if (context.playerCanAddBomb()) {
        context.player.lastAddBombTime = new Date();
        context.sendAddBombCommand(context.player.position.x, context.player.position.y);
}, this, 1, , 1, 1);
context.buttonAddBomb.fixedToCamera = true;
context.buttonAddBomb.priorityID = 2; // HERE

Nothing :(

Link to comment
Share on other sites


  • Recently Browsing   0 members

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