# \[extension\] better-sprite-data

**URL:** <https://forum.makecode.com/t/extension-better-sprite-data/46170>\
**Category:** Show & Tell\
**Tags:** extension\
**Created:** [September 28, 2026, 4:50am UTC](https://forum.makecode.com/t/extension-better-sprite-data/46170 "2026-09-28T04:50:16Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![VoxelMaster64](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/voxelmaster64/32/32075_2.png) [@VoxelMaster64](https://forum.makecode.com/u/VoxelMaster64)\
**Post date:** [September 28, 2026, 4:50am UTC](https://forum.makecode.com/t/extension-better-sprite-data/46170/1 "2026-09-28T04:50:16Z")

</div>

Ever wanted to have functions in the data of your sprite? functions that have _parameters_?

> [@Method Parameters in Blocks?](https://forum.makecode.com/t/method-parameters-in-blocks/46052/1):
>
> I’m using @richard’s Improved Sprite Data extension to define methods local to sprites (A.K.A. “Sprite Functions”). These are quite limited because they do not accept parameters, meaning everything I want to pass to the function must be set in a sprite data variable (or worse, a global variable)

well, this extension adds exactly that!

> **[GitHub - c-minusminus/better-sprite-data: adds more to the arcade-sprite-data extension](https://github.com/c-minusminus/better-sprite-data)**
>
> adds more to the arcade-sprite-data extension

This took roughly 20 minutes to make, and should be simple to use. For help using the extention, if you copy-paste [this code](https://github.com/c-minusminus/better-sprite-data/blob/master/test.ts) into the js editor in your project, you can see how to use it in blocks.

---

<div class="post-metadata">

**Author:** ![Sword\_Studios](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sword_studios/32/35216_2.png) [@Sword\_Studios](https://forum.makecode.com/u/Sword_Studios)\
**Post date:** [September 29, 2026, 4:01am UTC](https://forum.makecode.com/t/extension-better-sprite-data/46170/2 "2026-09-29T04:01:44Z")

</div>

\*instantly bookmarks topic\*

@Soleb244

---

<div class="post-metadata">

**Author:** ![VoxelMaster64](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/voxelmaster64/32/32075_2.png) [@VoxelMaster64](https://forum.makecode.com/u/VoxelMaster64)\
**Post date:** [September 29, 2026, 4:04am UTC](https://forum.makecode.com/t/extension-better-sprite-data/46170/3 "2026-09-29T04:04:10Z")

</div>

> [@VoxelMaster64](#):
>
> well, this function adds exactly that!

@AlexK can you edit "function’ into “extension”?

---

<div class="post-metadata">

**Author:** ![CodaKnight](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/codaknight/32/33491_2.png) [@CodaKnight](https://forum.makecode.com/u/CodaKnight)\
**Post date:** [September 29, 2026, 4:41am UTC](https://forum.makecode.com/t/extension-better-sprite-data/46170/4 "2026-09-29T04:41:13Z")

</div>

Ahhh. For a second, I thought this was `@richard`’s Improved Sprite Data function still, until I realized it was only meant for data-functions that accept sprite as parameters only. Good stuff!!!

The only thing I find interesting/hard to understand, is the parameter take in, since it shows only shows one reporter parameter, and could get kinda confusing since some would think there is only one parameter? Unless, you explained it or “it” explained itself with the array when you use the run function block.

---

<div class="post-metadata">

**Author:** ![randomuser](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/randomuser/32/32505_2.png) [@randomuser](https://forum.makecode.com/u/randomuser)\
**Post date:** [September 29, 2026, 4:42am UTC](https://forum.makecode.com/t/extension-better-sprite-data/46170/5 "2026-09-29T04:42:49Z")

</div>

Woah! How do I use this? I see I can put a function as a sprite data but how do I set and pass parameters? 🤔

---

<div class="post-metadata">

**Author:** ![AlexK](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/alexk/32/33339_2.png) [@AlexK](https://forum.makecode.com/u/AlexK)\
**Post date:** [September 29, 2026, 4:48am UTC](https://forum.makecode.com/t/extension-better-sprite-data/46170/6 "2026-09-29T04:48:31Z")

</div>

Yup!

---

<div class="post-metadata">

**Author:** ![TheEarth](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/theearth/32/34579_2.png) [@TheEarth](https://forum.makecode.com/u/TheEarth)\
**Post date:** [September 29, 2026, 4:56pm UTC](https://forum.makecode.com/t/extension-better-sprite-data/46170/7 "2026-09-29T16:56:24Z")

</div>

Bro predicted it was alexk approving posts or either just said alexk for the love of the game

---

<div class="post-metadata">

**Author:** ![VoxelMaster64](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/voxelmaster64/32/32075_2.png) [@VoxelMaster64](https://forum.makecode.com/u/VoxelMaster64)\
**Post date:** [September 29, 2026, 5:04pm UTC](https://forum.makecode.com/t/extension-better-sprite-data/46170/8 "2026-09-29T17:04:36Z")

</div>

since the parameter is an array, it allows it to be like

```typescript
mySprite.runDataFunction("testFunc", [0, "hello", mySprite, myTilemap])

```

and that would be mostly the same as

```typescript
mySprite.testFunc(0, "hello", mySprite, myTilemap)

```

to factually get said value, you do:

```typescript
mySprite.setDataFunction("move", function (p: any[]) {
    mySprite.x += p[0]
    mySprite.y += p[1]
})

```

Basically, the array is what allows multiple parameters. it can seem confusing at first, but it allows any function. (that doesnt return a value, but I have an idea for that)

---

<div class="post-metadata">

**Author:** ![VoxelMaster64](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/voxelmaster64/32/32075_2.png) [@VoxelMaster64](https://forum.makecode.com/u/VoxelMaster64)\
**Post date:** [September 29, 2026, 5:10pm UTC](https://forum.makecode.com/t/extension-better-sprite-data/46170/9 "2026-09-29T17:10:51Z")

</div>

the parameter is an array, so you can have pretty much any mount of parameters, like this:

> **[test better-sprite-data](https://arcade.makecode.com/30394-63726-11379-40227)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![randomuser](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/randomuser/32/32505_2.png) [@randomuser](https://forum.makecode.com/u/randomuser)\
**Post date:** [September 29, 2026, 5:16pm UTC](https://forum.makecode.com/t/extension-better-sprite-data/46170/10 "2026-09-29T17:16:30Z")

</div>

Ahh I understand in javascript, but what about blocks? It’s just a blank ‘parameters’ variable for me

---

<div class="post-metadata">

**Author:** ![VoxelMaster64](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/voxelmaster64/32/32075_2.png) [@VoxelMaster64](https://forum.makecode.com/u/VoxelMaster64)\
**Post date:** [September 30, 2026, 4:03am UTC](https://forum.makecode.com/t/extension-better-sprite-data/46170/11 "2026-09-30T04:03:09Z")

</div>

in blocks, you might need to update the extension for it to be accurate.

Speaking of update…

# You can now return values!

in this update, 2 blocks were added:

 ![Screenshot 2026-09-29 3.53.43 PM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/4/6/46059d0c8cc423e10c17cf6bc1ee5bfba16f9df4.png)

What do they do? Its pretty simple, the `[return (array of ...)]` is the return block. It returns a value. the `(sprite function last returned)` will contain the data that was lat returned. You can see the 2 blocks in action here:

> **[better-sprite-data test return](https://arcade.makecode.com/S33247-10277-84842-08956)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

@teal256, I saw that you also wanted this, so here!
