Jump to content

How to pass click event?


HugoMM
 Share

Recommended Posts

We use ee3 for events in v3 and it doesn't have support for triggering events. The easiest thing to do would be to simply call the image A callback within the image B callback.

Or don't have an event on image B at all and just let the button A deal with it?

Link to comment
Share on other sites

If image B has not been enabled for input, it's literally impossible for it to prevent any other image from receiving input events. Images that have not been input enabled are completely ignored by the input system and do not block anything. I would double-check your code. Either that, or there's something else going on here that hasn't been explained fully in your post.

Link to comment
Share on other sites

Yes, indeed - what Rich said. The only thing I can think of without seeing any code is that you're not setting the buttons up correctly for Phaser? Should look something like this:

 

        this.button = this.add.sprite(xy.x, xy.y - 96, 'start').setInteractive();
        this.button.on('pointerover', function(){this.button.setTint(0xf0ff00);}, this)
        this.button.on('pointerout', function(){this.button.setTint(0xffffff);}, this)
        this.button.on('pointerdown', function(){
                  //do things on click
        });

 

Link to comment
Share on other sites

Can't you use emit? To use NoxBrutalis' example:

this.button = this.add.sprite(xy.x, xy.y - 96, 'start').setInteractive();
this.button.on('pointerover', function(){this.button.setTint(0xf0ff00);}, this)
this.button.on('pointerout', function(){this.button.setTint(0xffffff);}, this)
this.button.on('pointerdown', function(){
  //do things on click
});

// This line calls the function associated with the button's 'pointerdown' event
this.button.emit('pointerdown');

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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