# Is there a way to count a sprite clone

**URL:** <https://forum.makecode.com/t/is-there-a-way-to-count-a-sprite-clone/45121>\
**Category:** Help\
**Tags:** game, make, extension, demo, rpg\
**Created:** [July 29, 2026, 2:09pm UTC](https://forum.makecode.com/t/is-there-a-way-to-count-a-sprite-clone/45121 "2026-07-29T14:09:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Spike](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/spike/32/33316_2.png) [@Spike](https://forum.makecode.com/u/Spike)\
**Post date:** [July 29, 2026, 2:09pm UTC](https://forum.makecode.com/t/is-there-a-way-to-count-a-sprite-clone/45121/1 "2026-07-29T14:09:15Z")

</div>

Is there a way to see what a clone is like? If I made two of the same sprite, how would I know which one was made second? :crab:

 ![I want to know how to give sprites clones their own separate IDs that say a number on what order they were created in.](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/0/f/0f6c12d29b04d46217cdbce43e3511012e57cc01.png)

---

<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:** [July 29, 2026, 5:09pm UTC](https://forum.makecode.com/t/is-there-a-way-to-count-a-sprite-clone/45121/2 "2026-07-29T17:09:27Z")

</div>

Yep! One common way is to keep a counter that increases every time you create a sprite.

For example:

```typescript
let nextID = 0

function createEnemy() {
    let enemy = sprites.create(...)
    sprites.setDataNumber(enemy, "id", nextID)
    nextID++
}

```

Now every sprite has its own unique ID:

- First sprite → ID 0
- Second sprite → ID 1
- Third sprite → ID 2
- etc.

Later, you can get a sprite’s ID with:

```typescript
sprites.readDataNumber(enemy, "id")

```

If you’re using Blocks, there are **Sprite Data** blocks that let you **set number data** and **read number data** from a sprite, so you can do the same thing without switching to JavaScript.

You could also mention another option:

If you only need to know which sprite was created most recently, `sprites.allOfKind(...)` returns the sprites in creation order, so the last element is usually the newest. However, if sprites get destroyed, I wouldn’t rely on that. Giving each sprite its own ID with Sprite Data is the more reliable approach.

---

<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:** [July 29, 2026, 5:12pm UTC](https://forum.makecode.com/t/is-there-a-way-to-count-a-sprite-clone/45121/3 "2026-07-29T17:12:03Z")

</div>

you can use the sprites data extension! (and/or a “enemies made” variable (I named it “ID” in my code))

> **[different enemy ids](https://arcade.makecode.com/S68017-71340-21229-90585)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

I also included an example usage in there for you.

---

<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:** [July 30, 2026, 2:34am UTC](https://forum.makecode.com/t/is-there-a-way-to-count-a-sprite-clone/45121/4 "2026-07-30T02:34:35Z")

</div>

Try using sprite.id if you want to separate them
