I was working on an extension and I was wondering how to create enums that can be added on to like the sprite kinds
Edit in spritekind.ts I found this
//% blockHidden=1 shim=ENUM_GET deprecated=true
//% blockId=spritetype block="$kind" enumInitialMembers="Player,Projectile,Food,Enemy"
//% enumName=SpriteKindLegacy enumMemberName=kind enumPromptHint="e.g. Coin, Fireball, Asteroid..."
export function _spriteType(kind: number): number {
return kind;
I am wondering how does this make the sprite kinds editable
I know this
enumPromptHint="e.g. Coin, Fireball, Asteroid..."
make the add sprite kind text but how does it get edited?
4 Likes
the most im gonna say is I tried messing with this once and I had to reboot my PC so yeah
1 Like
This looks like a deprecated version of the function. You might have better luck with the version actually in use. I’ll try to find it myself and look at it. Obviously the thing to do is simply copy/paste this exact code into your project and see if it works. Remove the deprecated tag ofc.
1 Like
Im not smart enough for this 
1 Like
Can’t you already create and edit sprite kinds already?
1 Like
Ok looks like the documentation is here:
Scroll down to the section labeled “Creating enumerations with blocks”
Actually, the correct implementation is directly above the one you found, like, just go back and look at _spriteKind instead of _spriteType. They are right next to each other!
The specified function simply defines the function that takes in the enum and returns the value, and the block definition causes a sprite kind enum to be created when the block is used. Looks like the version you found was depreciated because the “ENUM_GET” shim only allows for adding new options, so they made “KIND_GET” to support renaming and deleting as well.
2 Likes