Jump to content

onChildInputDown in phaser 3?


Recommended Posts

Hello, I have that doubt, I try to find the equivalent of this property onChildInputDown.add () from phaser 2 to phaser 3, what would be the equivalent.

I thought it could be .on (event), but I can not find the exact face for onChildInputDown, if you can help me, I'd really appreciate it.


Link to comment
Share on other sites

Hi @Samme, I'm a little confused, look at this is the original code:

this.cookieLayer = this.add.group();

cookies.forEach((cookie: Cookie) => {
            var point = this.pointForCookie(cookie.column, cookie.row);
            var createdCookie = this.cookieLayer.create(point.x, point.y, cookie.spriteName());
             createdCookie.inputEnabled = true;
            createdCookie.events.onInputDown.add(this.touchesBegan, this);
            createdCookie.events.onInputUp.add(this.touchesEnd, this);
            cookie.sprite = createdCookie;

For what you tell me, you would have to create by means of createMultiple (), to be able to access the hitArea and hitAreaCallback, as a value would be the function that I send to call?

On the other hand you mention setInteractive (), I was reviewing the manual and I do not see any example that applies in creatMultiple as the following example

gameObject.setInteractive().on('pointerdown', function(pointer, localX, localY, event){
    // ...


Link to comment
Share on other sites


  • Recently Browsing   0 members

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