[Extension] - Declutter your variables!

Hey everyone, I’m back from my hiatus and I’m planning to get serious now! In the following weeks/months you can expect:

  • A list datatype extension (Python-like)
  • A map/dictionary datatype extension (similar to BlockObjects)
  • A ‘BetterSettings’ extension, adding new datatypes to save using the settings namespace
  • Making my version of @PixelDoodle’s CyberShift
  • Helping with @AbstractDesigner’s Speedun
  • More tutorials such as this one I made a while back
  • UI Element extension
  • A jam of my own? :face_with_raised_eyebrow:

And much more!
I’ll also try to participate in more jams, like @Unique’s UAT2

But anyways, that aside - it’s time to talk about the extension:

But what is cluttering anyway?

I’d define cluttering in general as adding unecessary components to your code that make your workspace harder to use and reduce efficiency, but also make it harder to understand the code (especially for collaborators).

This is mostly prominent with block code, but it’s not uncommon for JS code too. A form of cluttering I often see is redundant variables taking up the namespace that are only used once for temporary sprites.

How does this extension help, and how does it work?

To try and combat this problem, I thought of a simple sprite management stack. (Well, it’s not really a stack, but it sounds better so we’ll roll with that terminology)

Using the extension, you can load a sprite object to this stack with a label, and the sprite can later be accessed and used as any other sprite stored in a variable (img. 1).

When you’re done using the sprite, you can offload it, which will remove it from the stack and destroy it (img. 2).

WARNING (1/2): Destroying a sprite won’t remove it from the stack alone
(2/2): Accesing non-existing items will throw a sprite stack extension

Available blocks

There are 4 available blocks at the moment:

Load sprite
Loads the given sprite into the stack under the defined name

load <sprite> with name <name>

Load sprite

Get sprite from stack
Returns sprite object by name from the stack. If a sprite with that name is not found, an error is thrown.

get sprite with name <name>

Get sprite

Offload sprite
Destroys and removes sprite from the stack by name. If a sprite with that name is not found, an error is thrown.

offload sprite with name <name>

Offload sprite

Check if sprite with a name exists
Returns true if a sprite with the given name exists in the stack.

stack contains sprite with name <name>

Stack contains sprite

To conclude this, I’d like to say that I’ve been sitting on this idea for quite a while, so I’m glad to release it now since it only took me like 15 minutes to make this extension.
If you have any questions or problems, feel free to ask here or submit an issue!

(Repo/extension link)


Thank you everone for the support, it means a lot! If you have any suggestions you can leave them here for future development although i’m moving on with other projects now so it won’t be in focus


I have no idea what that means but it sounds genius!

Well, it’s just for cleaning up, honestly. Say you had a title screen sprite that only appeared at the start, creating a variable just for it clutters up your namespace. I’ve seen this with so many projects where there are many redundant variables. With this extension, you can just drop them in the stack and remove them when they’re not required anymore. That way, your variables remain clean for only the values you really need.


This is insane! I was going to add this to Pixel Smash but then I remembered that if it doesnt mean anything for the game, I was gonna have to go to Javascript, remove the extension, and Cry for several hours because I get the message: “Program to big to convert to blocks”

Still really cool though!


@Sarge Love to see you back! Also like, this extension is the definition of :sparkles:optimization :sparkles:. Great stuff!

(p.s. this extension is now one of my favs for the sole fact that i hate when my projects end up having like 4 million placeholder sprite variables, so “declutter” I shall do :grin:!)


I can’t wait to have Speedun fixed! (。・ω・。)

1 Like

Wut dus that mean…

somehow i understand this. this would be helpful for my other games that are not arcade makecode

1 Like

Thank you! It was an idea I had for a very long time now, just never brought myself to do it…
After all, it only took 20 minutes to put together the code for it so I don’t know what held me back for all that time. I’m guessing it’s the fact that I’m at my prime regarding TS and JS as I’m a lot better at working with them but also understanding their components.
Anyway, this was sort of a quick util idea I came up with, if you have any other cool ideas for helpful extensions you’d want someone to make, you can always reach out! I love making extensions that help the community.

P.S: If I accumulate enough of these utility extensions in the following months, I might make them all into one big collection/compilation extension!


If you’re refering to the whole post, it’s a bit of a complicated extension. Seeing as you’re new to MakeCode, it shouldn’t bother you too much at this stage.
The primary idea is reducing the number of variables used. In bigger block projects, coders often create variables for temporary sprites (because sprites have to be stored somewhere), so that kind of creates a mess. Instead of that, with this extension you can create temporary sprites that behave just like regular sprites but don’t use variables. I hope this cleared up some things! If you have any further questions, lmk!


Thank you everyone so much once again for the overwhelming support on this! I’m glad people find it useful!

I’m releasing my next extension by the end of this week for sure, since my spring break starts on thursday, so I’ll be getting straight back into GameDev and that includes helping you as well as some other projects on the side, my own or not


I love this extension! It’s very well coded and very helpful! I’ve had some games where it seemed that I had reached a variable limit, so this will be great for that! I’m already using it in one of my games I’m making! (I’ll make sure to credit you when I release the game.)

I have recently been working on a similar extension coincidentally, it’s variables rather then sprites.

But I do actually have a question, for some reason I haven’t been able to figure this one out.

How do you add a string input to a block like this (I forgot what these are called)?

1 Like

Okie. :slight_smile:

Assuming a function named foo, and string argument bar:

function foo(bar: string) {
    // do something

Adding the //% block formatting will automatically turn it into a text field.

If you want to use it in a custom block arrangement you’d use $bar within the block tag.

//% block="example $bar"
function foo(bar: string) {

Finally, you can add default values or shadow blocks to your text input like this:

//% bar.defl = <value>
//% bar.shadow = <shadow>

For more info see


Hope this helps!


I think I get it… (nvm lol)

I feel like it’s almost impossible for me to make a game without this extension now… :laughing: Same goes for the BetterSettings extension!

1 Like

Haha that’s good to hear, since I was kind of losing faith. I must admit I have stopped using this extension, so it’s good someone still finds it useful :smiley:

1 Like

umm… this was supposed to say, throw an exception, not extension, lol :laughing:

1 Like