Hi
I have a variety of blocks of different colours and I want to know how to get the colour of the block which has been hit by a ball. Im using a collider like this.
this.physics.add.collider(this.ball, this.blocks, this.ballHitBlock, null, this);
ballHitBlock(ball, block)
{
this.emitSparks(block)
block.disableBody(true, true);
}
emitSparks(block)
{
const x = block.x
const y = block.y
this.createEmitter0(x, y, 0xffff00)
}
I’m able to get the x, y of the block hit but don’t know how to get the frame number of the texture atlas that the block has used. I would like to identify that frame, identify its colour and then pass it to the emitter to produce sparks the same colour as the the block.