Find whether the sprite is touching another sprite you say.
Sprites are touching if they share the same LED.
let item: game.LedSprite = null;
item.isTouching(null);
true
if the two sprites are touching.
This program creates two sprites called matter
and antimatter
,
and then checks whether they are touching. If they are, there is an
explosion.
let matter = game.createSprite(2, 2);
let antimatter = game.createSprite(2, 2);
if (matter.isTouching(antimatter)) {
basic.pause(500);
basic.clearScreen();
basic.showString("BOOM!");
}