# My first time trying to make an extension

**URL:** <https://forum.makecode.com/t/my-first-time-trying-to-make-an-extension/42697>\
**Category:** Show & Tell\
**Created:** [March 14, 2026, 6:46pm UTC](https://forum.makecode.com/t/my-first-time-trying-to-make-an-extension/42697 "2026-03-14T18:46:45Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![YamJam](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yamjam/32/29681_2.png) [@YamJam](https://forum.makecode.com/u/YamJam)\
**Post date:** [March 14, 2026, 6:46pm UTC](https://forum.makecode.com/t/my-first-time-trying-to-make-an-extension/42697/1 "2026-03-14T18:46:45Z")

</div>

I made my first extension! It’s _supposed_ to add one block that sets the background to a random color. The reason why I said its supposed to do that is because there is an error I can’t find and… I just suck at making stuff ☹

anyways here’s the extension!  
[YamJam-dev/background-extension: A MakeCode project](https://github.com/YamJam-dev/background-extension)

---

<div class="post-metadata">

**Author:** ![RoboVacDev](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/robovacdev/32/29619_2.png) [@RoboVacDev](https://forum.makecode.com/u/RoboVacDev)\
**Post date:** [March 14, 2026, 9:56pm UTC](https://forum.makecode.com/t/my-first-time-trying-to-make-an-extension/42697/2 "2026-03-14T21:56:57Z")

</div>

Think you can already do that with the block but hey! Great attempt!

---

<div class="post-metadata">

**Author:** ![YamJam](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yamjam/32/29681_2.png) [@YamJam](https://forum.makecode.com/u/YamJam)\
**Post date:** [March 14, 2026, 11:05pm UTC](https://forum.makecode.com/t/my-first-time-trying-to-make-an-extension/42697/3 "2026-03-14T23:05:43Z")

</div>

I already knew that, I just wanted to try making an extension and I actually needed _something_ for it to add, so I just did that 😅

---

<div class="post-metadata">

**Author:** ![WoofWoof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/woofwoof/32/32523_2.png) [@WoofWoof](https://forum.makecode.com/u/WoofWoof)\
**Post date:** [March 14, 2026, 11:06pm UTC](https://forum.makecode.com/t/my-first-time-trying-to-make-an-extension/42697/4 "2026-03-14T23:06:53Z")

</div>

Hi! Looks like it’s broken because you need some single quotes around the groups array, and normal quotes around the name. It should be `groups='["background color"]'` instead of `groups=['background color']`  
You can see an example of this being used in Explorer → mixer → ns.ts  
You’ll also need to specify which group the block is in, so the whole thing should look like this:

```auto
//% color="#ADD8E6" weight=100 block="Background"
//% groups='["background color"]'
namespace BG {
    //% block
    //% group="background color"
    export function changeBG() {
        scene.setBackgroundColor(randint(1, 15))
    }
}

```

The thing is, it will only actually show the group name if there is more than 1 block defined. You also don’t need to specify the groups at the top in order to use them, you can just use the block specification, so what I would write is this:

```auto
//% color="#ADD8E6" weight=100 block="Background"
namespace BG {
    //% block
    //% group="background color"
    export function changeBG() {
        scene.setBackgroundColor(randint(1, 15))
    }

    //% block
    //% group="other group"
    export function otherBlockSoGroupsShowUp() {

    }
}

```

Which looks like this:

 ![Screenshot 2026-03-14 at 6.54.29 PM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/8/d/8de45d2dc17516344a3f322ec94c2c6787013fa7.png)

---

<div class="post-metadata">

**Author:** ![YamJam](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yamjam/32/29681_2.png) [@YamJam](https://forum.makecode.com/u/YamJam)\
**Post date:** [March 15, 2026, 1:26am UTC](https://forum.makecode.com/t/my-first-time-trying-to-make-an-extension/42697/5 "2026-03-15T01:26:19Z")

</div>

@WoofWoof I did what you said and it worked! Sort of… I also wanted to add another block so I did but it the first one doesn’t show up ☹ I looked through my code dozens of times but it still doesn’t seem to work ☹ ☹ ☹ ☹ ☹ ☹ 😭

> **[background extension](https://arcade.makecode.com/S03864-78647-37691-70151)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![WoofWoof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/woofwoof/32/32523_2.png) [@WoofWoof](https://forum.makecode.com/u/WoofWoof)\
**Post date:** [March 15, 2026, 9:15pm UTC](https://forum.makecode.com/t/my-first-time-trying-to-make-an-extension/42697/6 "2026-03-15T21:15:16Z")

</div>

Looks like you need to move your //% block and //% group=“screen split half” lines to be under the variable definitions. You can only turn functions into blocks, so those block definition lines can only work directly above a function definition.  
Those variable definitions will still run just fine. They will always run at the start of the program like all other variable definitions.

---

<div class="post-metadata">

**Author:** ![YamJam](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yamjam/32/29681_2.png) [@YamJam](https://forum.makecode.com/u/YamJam)\
**Post date:** [March 15, 2026, 9:24pm UTC](https://forum.makecode.com/t/my-first-time-trying-to-make-an-extension/42697/7 "2026-03-15T21:24:32Z")

</div>

Im making 2 new blocks but 2 of the blocks stilllllllllllll don’t show up.

> **[background extension](https://arcade.makecode.com/S03864-78647-37691-70151)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

I added a block to use a sprite as the background and im trying to add another one where you can make a background animation but the animation block doesn’t show up, AS WELL as the split screen into halves.

ALSO I want to add an image editor to the sprite background block but instead I got the gallery list…

PLEASE HELP ME 😭 😭 😭 😭 sob 😭 😭 😭 😭 😢

the code for the half screen one is this:  
BG.splitScreenHalf(color1, color2)

---

<div class="post-metadata">

**Author:** ![WoofWoof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/woofwoof/32/32523_2.png) [@WoofWoof](https://forum.makecode.com/u/WoofWoof)\
**Post date:** [March 16, 2026, 4:18pm UTC](https://forum.makecode.com/t/my-first-time-trying-to-make-an-extension/42697/8 "2026-03-16T16:18:57Z")

</div>

I can look at it later, but right now I can tell you that to make an image in the block it’s something like

```auto
//% block=“imageThingy $thing”
//% thing.shadow=screen_image_picker
function imageThingy(thing:Image) {}

```

---

<div class="post-metadata">

**Author:** ![YamJam](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yamjam/32/29681_2.png) [@YamJam](https://forum.makecode.com/u/YamJam)\
**Post date:** [March 19, 2026, 12:39am UTC](https://forum.makecode.com/t/my-first-time-trying-to-make-an-extension/42697/9 "2026-03-19T00:39:01Z")

</div>

By the way, the background is finished(kinda), but does anyone know why the array doesn’t show up in the new animation background block thingymajig? Here’s what I did:

`export function backgroundAnimation(frames: Image``, interval: number, scale: number) {`  
`backgroundAnim = sprites.create(frames[1], SpriteKind.backAnim)`  
`backgroundAnim.z = 1 / 0 * -1`  
`backgroundAnim.setFlag(SpriteFlag.RelativeToCamera, true)`  
`backgroundAnim.scale = scale`  
`backgroundAnim.setPosition(scene.cameraProperty(CameraProperty.X), scene.cameraProperty(CameraProperty.Y))`  
`animation.runImageAnimation(`  
`backgroundAnim,`  
`frames,`  
`interval,`  
`true`

---

<div class="post-metadata">

**Author:** ![YamJam](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yamjam/32/29681_2.png) [@YamJam](https://forum.makecode.com/u/YamJam)\
**Post date:** [March 20, 2026, 12:22am UTC](https://forum.makecode.com/t/my-first-time-trying-to-make-an-extension/42697/10 "2026-03-20T00:22:28Z")

</div>

Yeah I’m calling the bird himself  
@richard, why doesn’t the array show up in the background animation block?

> **[background extension](https://arcade.makecode.com/S52187-54820-54555-65348)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/b/a/ba7457e8e766ec52e9aaa8b5556eb0480b77a184.png)  
as you can see, my block doesn’t have any array in it, even thought I wrote this:  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/f/9/f9372e47612fe68be542041ce1649802cd697360.png)

---

<div class="post-metadata">

**Author:** ![YamJam](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yamjam/32/29681_2.png) [@YamJam](https://forum.makecode.com/u/YamJam)\
**Post date:** [March 22, 2026, 7:00am UTC](https://forum.makecode.com/t/my-first-time-trying-to-make-an-extension/42697/11 "2026-03-22T07:00:01Z")

</div>

welp, there goes any hope in that happening ☹

Oh and I added a sprite editor to the sprite background block, here ya go!

anyways, heres another update: [YamJam-dev/pxt-background-extension: A simple and unperfected extension that adds a couple blocks to spice up the background of your game.](https://github.com/YamJam-dev/pxt-background-extension)

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [March 23, 2026, 5:06pm UTC](https://forum.makecode.com/t/my-first-time-trying-to-make-an-extension/42697/12 "2026-03-23T17:06:23Z")

</div>

@YamJam you need to set the shadow block for array arguments.

if you want an array to appear, it would look like this:

```auto
//% frames.shadow=lists_create_with

```

if you wanted the animation block to appear, you would use the block id of that function like so:

```auto
//% frames.shadow=animation_editor 

```

---

<div class="post-metadata">

**Author:** ![YamJam](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yamjam/32/29681_2.png) [@YamJam](https://forum.makecode.com/u/YamJam)\
**Post date:** [March 24, 2026, 2:52am UTC](https://forum.makecode.com/t/my-first-time-trying-to-make-an-extension/42697/13 "2026-03-24T02:52:16Z")

</div>

It’s always the shadow thing! Thanks `@richard`, I’ll try it.
