What does "parts" attribute do?

What exactly is the parts attribute for in the block annotations, please? There are examples in the “game” extension for the Microbit. When is it required and for what?

//% weight=60 blockGap=8 help=game/create-sprite
//% blockId=game_create_sprite block="create sprite at|x: %x|y: %y"
//% parts="ledmatrix"
export function createSprite(x: number, y: number): LedSprite {
    let p = new LedSprite(x, y);
    return p;

Those attributes shouldn’t necessary for micro:bit! I think the led matrix ones just never got cleaned up. It’s used for the breadboarding support MakeCode has. The easiest place to see it in action is maker.makecode.com; as you start to place blocks in the workspace you should see the simulator add the required hardware components to a breadboard.

Oh, I see. That’s a pretty nifty simulator.

Erm, is it possible to generate simulators for various LED displays such as the Pimoroni scroll:bit (and other things which use the IS31FL3731 matrix driver IC), or the Neopixel ZIP halo, the 8x8 ZIP tile, etc?

Currently we don’t support any “shape” for the LEDs.

Ah, but I see the maker.makecom.com environment uses the sprite editor which looks like the one in Arcade, and it can create an image of any dimension. I wish you could make a monochrome copy of that for the Microbit world!

@richard can the sprite editor a Microbit image literal? We have grayscale in microbit :slight_smile:

You could add a flag that does it but the sprite editor seems like overkill to me