# Is there a way to have all sprites of kind 'Player' in a variable?

**URL:** <https://forum.makecode.com/t/is-there-a-way-to-have-all-sprites-of-kind-player-in-a-variable/18880>\
**Category:** Help\
**Created:** [March 31, 2023, 4:49pm UTC](https://forum.makecode.com/t/is-there-a-way-to-have-all-sprites-of-kind-player-in-a-variable/18880 "2023-03-31T16:49:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samsano](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/samsano/32/8307_2.png) [@Samsano](https://forum.makecode.com/u/Samsano)\
**Post date:** [March 31, 2023, 4:49pm UTC](https://forum.makecode.com/t/is-there-a-way-to-have-all-sprites-of-kind-player-in-a-variable/18880/1 "2023-03-31T16:49:53Z")

</div>

i want to use some way of checking if the ‘x’ value (position) of every sprites of kind ‘Player’. Is there a way of doing that?

---

<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:** [March 31, 2023, 6:13pm UTC](https://forum.makecode.com/t/is-there-a-way-to-have-all-sprites-of-kind-player-in-a-variable/18880/2 "2023-03-31T18:13:16Z")

</div>

Using a ‘For value of array’ block you can do ‘For value of array of all sprites of kind player’ and check the x of each value!

---

<div class="post-metadata">

**Author:** ![YuHayate](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yuhayate/32/8275_2.png) [@YuHayate](https://forum.makecode.com/u/YuHayate)\
**Post date:** [March 31, 2023, 6:16pm UTC](https://forum.makecode.com/t/is-there-a-way-to-have-all-sprites-of-kind-player-in-a-variable/18880/3 "2023-03-31T18:16:24Z")

</div>

well you can do this

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

---

<div class="post-metadata">

**Author:** ![Samsano](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/samsano/32/8307_2.png) [@Samsano](https://forum.makecode.com/u/Samsano)\
**Post date:** [March 31, 2023, 6:52pm UTC](https://forum.makecode.com/t/is-there-a-way-to-have-all-sprites-of-kind-player-in-a-variable/18880/4 "2023-03-31T18:52:52Z")

</div>

Thanks for the help! Arrays sin’t my strong suit so i would never have gotten this in a million years 🙃

---

<div class="post-metadata">

**Author:** ![Samsano](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/samsano/32/8307_2.png) [@Samsano](https://forum.makecode.com/u/Samsano)\
**Post date:** [March 31, 2023, 7:00pm UTC](https://forum.makecode.com/t/is-there-a-way-to-have-all-sprites-of-kind-player-in-a-variable/18880/5 "2023-03-31T19:00:31Z")

</div>

Thanks for showing the code, even though i don’t understand French i understand which blocks is wich. 😅

---

<div class="post-metadata">

**Author:** ![YuHayate](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yuhayate/32/8275_2.png) [@YuHayate](https://forum.makecode.com/u/YuHayate)\
**Post date:** [April 27, 2023, 4:54pm UTC](https://forum.makecode.com/t/is-there-a-way-to-have-all-sprites-of-kind-player-in-a-variable/18880/6 "2023-04-27T16:54:10Z")

</div>

ya sorry for that  
after you start using arrays it is easyer
