Hey there guys!
I working on chess game with Phaser 3. And so far everything is amazing. Right now I'm working on event handlers for the pieces(figures). Take a look:
for(let i = 0; i < this.pieces.length; i++) {
this.pieces[i].setInteractive();
this.pieces[i].on('clicked', ()=>{
console.log('Piece clicked'));
}, this);
}
This is taken from the example HERE.
So my problem is this fragrament of the code:
this.input.on('gameobjectup', function (pointer, gameObject)
{
gameObject.emit('clicked', gameObject);
}, this);
Can someone explain the whole structure? Or maybe suggest cleaner way to do it?