# Placing Copies of a Sprite

**URL:** <https://forum.makecode.com/t/placing-copies-of-a-sprite/11617>\
**Category:** Help\
**Created:** [January 6, 2022, 12:59am UTC](https://forum.makecode.com/t/placing-copies-of-a-sprite/11617 "2022-01-06T00:59:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![GoMustangs](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gomustangs/32/4323_2.png) [@GoMustangs](https://forum.makecode.com/u/GoMustangs)\
**Post date:** [January 6, 2022, 12:59am UTC](https://forum.makecode.com/t/placing-copies-of-a-sprite/11617/1 "2022-01-06T00:59:37Z")

</div>

I want to place copies of a sprite on duplicates of a certain tile.

I would like to be able to place three green grass tiles in my tile map and spawn three identical enemy sprites on the green grass tiles (one enemy on each green grass tile).

My code will successfully do this sometimes, but sometime when I refresh my game it only spawns one or two enemies.

Any suggestions?

> **[placeEnemyPrototype](https://arcade.makecode.com/14072-57990-57727-78932)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

PS: I know I’ve asked multiple questions this week. I do really appreciate getting help with this stuff. 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:** [January 6, 2022, 5:03pm UTC](https://forum.makecode.com/t/placing-copies-of-a-sprite/11617/2 "2022-01-06T17:03:56Z")

</div>

This piece of code  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/9/90eea066e6e9d64724994e55ca7cbd57b78a2b1e.png)  
will take every tile of a certain type (the one in the array) and make a sprite and place it on that tile so every tile has a sprite on it (regardless of how many tiles are on the tilemap.) Here’s the code so you can edit it:

> **[placeEnemyPrototype (working)](https://arcade.makecode.com/25935-73155-23152-70507)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![GoMustangs](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gomustangs/32/4323_2.png) [@GoMustangs](https://forum.makecode.com/u/GoMustangs)\
**Post date:** [January 6, 2022, 7:21pm UTC](https://forum.makecode.com/t/placing-copies-of-a-sprite/11617/3 "2022-01-06T19:21:26Z")

</div>

Thanks! That is super helpful!
