Hello everyone!
I create boxes on the level, how to delete it when I click on a box?
this.matter.add.image(425, -100, ‘box’);
this.matter.add.image(325, -100, ‘box’);
this.input.once(‘pointerup’, () =>
{
// ???
});
Hello everyone!
I create boxes on the level, how to delete it when I click on a box?
this.matter.add.image(425, -100, ‘box’);
this.matter.add.image(325, -100, ‘box’);
this.input.once(‘pointerup’, () =>
{
// ???
});
It doesn’t work
SOLVED
function CreateBox(X, Y)
{
var Box = CurrentScene.matter.add.image(X, Y, 'block');
SetSpriteInteractive(Box, true);
Box.on('pointerdown', () =>
{
Box.destroy();
});
return Box;
}