# I'm trying to make a function that spawns multiple sprite copies

**URL:** <https://forum.makecode.com/t/im-trying-to-make-a-function-that-spawns-multiple-sprite-copies/11982>\
**Category:** Help\
**Tags:** game\
**Created:** [February 1, 2022, 5:27pm UTC](https://forum.makecode.com/t/im-trying-to-make-a-function-that-spawns-multiple-sprite-copies/11982 "2022-02-01T17:27:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BrightBronzSlingshot](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/brightbronzslingshot/32/5712_2.png) [@BrightBronzSlingshot](https://forum.makecode.com/u/BrightBronzSlingshot)\
**Post date:** [February 1, 2022, 5:27pm UTC](https://forum.makecode.com/t/im-trying-to-make-a-function-that-spawns-multiple-sprite-copies/11982/1 "2022-02-01T17:27:01Z")

</div>

I’m trying to make a function that will spawn two identical sprites on two identical tiles.

This is the code:  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/8/889cf0b78485bf17a8e06c2d15bfbb3b2e03c0d2.png)

On the tile map I have two copies of the tile, and I want the same two sprites to spawn on both of those tiles, but every time I refresh my game it does something different. Sometimes the sprite is on one of the tiles, and other times there is a copy of the sprite on both of the tiles.

Could someone help me figure out how to make the game consistently place two copies of the sprite on the two identical tiles? The tiles are right at the start of the level.

Here’s the game:

> **[BobicPrototype](https://arcade.makecode.com/66695-97762-04535-84285)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

Thanks.

---

<div class="post-metadata">

**Author:** ![Kiwiphoenix364](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/kiwiphoenix364/32/14368_2.png) [@Kiwiphoenix364](https://forum.makecode.com/u/Kiwiphoenix364)\
**Post date:** [February 2, 2022, 5:13pm UTC](https://forum.makecode.com/t/im-trying-to-make-a-function-that-spawns-multiple-sprite-copies/11982/2 "2022-02-02T17:13:50Z")

</div>

All you have to do is use this:  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/8/8f25ed3909aeec0b1817d99f41f8d2f85c634ea3.png)  
(have place “electricBeam” on top of “value”). The problem is that it always places on a random tile and that random tile can be the same as before, but with “value” it makes one go on each tile’s location.

Here’s the link:

> **[BobicPrototype (working)](https://arcade.makecode.com/42795-36312-44015-16149)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

Also welcome to the forum/community of Makecode!

---

<div class="post-metadata">

**Author:** ![BrightBronzSlingshot](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/brightbronzslingshot/32/5712_2.png) [@BrightBronzSlingshot](https://forum.makecode.com/u/BrightBronzSlingshot)\
**Post date:** [February 3, 2022, 4:59pm UTC](https://forum.makecode.com/t/im-trying-to-make-a-function-that-spawns-multiple-sprite-copies/11982/3 "2022-02-03T16:59:07Z")

</div>

Thanks so much for your help! I spent a lot of time stumped on that.
