# Storing Block objects on sprites

**URL:** <https://forum.makecode.com/t/storing-block-objects-on-sprites/24277>\
**Category:** Help\
**Created:** [November 15, 2023, 5:54pm UTC](https://forum.makecode.com/t/storing-block-objects-on-sprites/24277 "2023-11-15T17:54:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luke](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/luke/32/32519_2.png) [@Luke](https://forum.makecode.com/u/Luke)\
**Post date:** [November 15, 2023, 5:54pm UTC](https://forum.makecode.com/t/storing-block-objects-on-sprites/24277/1 "2023-11-15T17:54:00Z")

</div>

Is there a way to store the same block object on multiple sprites?  
In the status bar extension one can “attach” a status bar to multiple sprites and have each status bar remain separate to each other. However, whenever I try something similar with block objects it doesn’t seem to work.  
The main issue is that I have to use block objects as it’s the only way to “attach” a text sprite to a sprite

---

<div class="post-metadata">

**Author:** ![Sarge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sarge/32/19590_2.png) [@Sarge](https://forum.makecode.com/u/Sarge)\
**Post date:** [November 16, 2023, 9:27pm UTC](https://forum.makecode.com/t/storing-block-objects-on-sprites/24277/2 "2023-11-16T21:27:07Z")

</div>

![arcade-screenshot (1)](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/2/2f5ece924fe5ba9da3276b86e6db2b6571183020.png)

Here’s a hacky way I found to do it. If this is what you mean by assigning a single object to multiple sprites. If not, please elaborate so I can provide a correct solution

> **[Store object on multiple sprites](https://arcade.makecode.com/S65719-89042-63313-00084)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![Luke](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/luke/32/32519_2.png) [@Luke](https://forum.makecode.com/u/Luke)\
**Post date:** [November 16, 2023, 10:00pm UTC](https://forum.makecode.com/t/storing-block-objects-on-sprites/24277/3 "2023-11-16T22:00:54Z")

</div>

If the array was replaced by an “array of sprites of kind enemy” block would that work?

---

<div class="post-metadata">

**Author:** ![Sarge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sarge/32/19590_2.png) [@Sarge](https://forum.makecode.com/u/Sarge)\
**Post date:** [November 16, 2023, 10:22pm UTC](https://forum.makecode.com/t/storing-block-objects-on-sprites/24277/4 "2023-11-16T22:22:30Z")

</div>

Yep, should work, since that just returns a sprite array type

---

<div class="post-metadata">

**Author:** ![Luke](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/luke/32/32519_2.png) [@Luke](https://forum.makecode.com/u/Luke)\
**Post date:** [November 18, 2023, 6:56pm UTC](https://forum.makecode.com/t/storing-block-objects-on-sprites/24277/5 "2023-11-18T18:56:08Z")

</div>

There seems to be some issues with returning block objects stored on the sprite.  
In this test when the player overlaps with a sprite, the doughnut held by that sprite should disappear. However the doughnut that gets destroyed is always stored on the dog (which is defined last) so I don’t think the block object is being stored multiple times.

Basically, is there a way to store the object on multiple sprites but in a way that the block object of the sprite can be accessed and changed?

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/c/c5fad11cbaa6f99494e81babc02478d4bd68bc61.png)

> **[Store object on multiple sprites](https://arcade.makecode.com/S32381-12915-93016-48244)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![Sarge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sarge/32/19590_2.png) [@Sarge](https://forum.makecode.com/u/Sarge)\
**Post date:** [November 18, 2023, 7:02pm UTC](https://forum.makecode.com/t/storing-block-objects-on-sprites/24277/6 "2023-11-18T19:02:20Z")

</div>

I- still don’t understand quite what you’re trying to do (sorry I’m dumb 🫠)

---

<div class="post-metadata">

**Author:** ![Luke](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/luke/32/32519_2.png) [@Luke](https://forum.makecode.com/u/Luke)\
**Post date:** [November 20, 2023, 6:58pm UTC](https://forum.makecode.com/t/storing-block-objects-on-sprites/24277/7 "2023-11-20T18:58:01Z")

</div>

Nevermind I managed to fix it by putting the  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/0/0e49d0312d7c0a96fafece82b04fd08cc1eb189d.png) in a

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/e/e6634a88b58caaedc63896272243dd0c839ae316.png)
