How do you turn your code into a extension

EDIT: I later just copied an existing extension and replaced it’s block code
SECOND EDIT: For some reason it generated the delted code and ignored mine, so I will try again…
I already have the code for an extension (DISCLAIMER: The code is written by @richard, I only made it as extension code)
Just how do you turn it into an extension where you can just add it to the editor?
namespace Sprite {

    //% block

    export function arrayOfAllSprites() {

    const allSprites: Sprite[] = [];

    for (const key of Object.keys(game.currentScene().spritesByKind)) {

        for (const sprite of game.currentScene().spritesByKind[parseInt(key)].sprites()) {

            allSprites.push(sprite);

        }

    }

    return allSprites;

}

If you have a GitHub account, then click the GitHub button at the bottom of the editor and create a repo. More information can be found here.

If you don’t have a GitHub account, then you can just create a share link and use that! Fun fact: you can add a shared MakeCode project as an extension by pasting the share URL into the extension dialog (same place you paste github urls). The downside is you can’t update it later.

Im trying on this:

Ah, looks like you forked @darzu’s minimap extension. It’ll be a lot easier if you create a repo straight from inside the MakeCode Arcade editor instead.

To do that:

  1. Create a new project
  2. Switch to JavaScript
  3. Paste in your code
  4. Click the GitHub button at the bottom of the editor (next to the save button)
  5. Log in with your GitHub
  6. Create a repo
1 Like

got it
Thx