# How to select something specific from an array?

**URL:** https://forum.makecode.com/t/how-to-select-something-specific-from-an-array/43805
**Category:** Help
**Created:** [May 3, 2026, 12:43am UTC](https://forum.makecode.com/t/how-to-select-something-specific-from-an-array/43805 "2026-05-03T00:43:31Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![xInsqne1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/xinsqne1/32/34060_2.png) [@xInsqne1](https://forum.makecode.com/u/xInsqne1)
#### Post date: [May 3, 2026, 12:43am UTC](https://forum.makecode.com/t/how-to-select-something-specific-from-an-array/43805/1 "2026-05-03T00:43:31Z")

</div>

> **[Card Game \[Made on 5/2/2026\]](https://arcade.makecode.com/S45019-69414-49913-52885)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

I made this very simple base for a card game called “Spades” but I can’t select a specific card / also can’t figure it out. Could @WoofWoof or really anyone else help me out?  
**Press LMB to change turns and place a card into the middle onto the plate.**

---

<div class="post-metadata">

### Author: ![Tsist](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/tsist/32/20588_2.png) [@Tsist](https://forum.makecode.com/u/Tsist)
#### Post date: [May 3, 2026, 3:02am UTC](https://forum.makecode.com/t/how-to-select-something-specific-from-an-array/43805/2 "2026-05-03T03:02:28Z")

</div>

Use a “get value from” block. The number specifies the item from the array of your choice.

---

<div class="post-metadata">

### Author: ![redSprite](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/redsprite/32/34262_2.png) [@redSprite](https://forum.makecode.com/u/redSprite)
#### Post date: [May 3, 2026, 3:03am UTC](https://forum.makecode.com/t/how-to-select-something-specific-from-an-array/43805/3 "2026-05-03T03:03:37Z")

</div>

You could use a variable to select a specific value from an array and then remove it via it’s index.

---

<div class="post-metadata">

### Author: ![xInsqne1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/xinsqne1/32/34060_2.png) [@xInsqne1](https://forum.makecode.com/u/xInsqne1)
#### Post date: [May 3, 2026, 3:04am UTC](https://forum.makecode.com/t/how-to-select-something-specific-from-an-array/43805/4 "2026-05-03T03:04:35Z")

</div>

Updated link!

> **[Card Game \[Made on 5/2/2026\]](https://arcade.makecode.com/S45019-69414-49913-52885)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

### Author: ![xInsqne1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/xinsqne1/32/34060_2.png) [@xInsqne1](https://forum.makecode.com/u/xInsqne1)
#### Post date: [May 3, 2026, 4:27pm UTC](https://forum.makecode.com/t/how-to-select-something-specific-from-an-array/43805/5 "2026-05-03T16:27:42Z")

</div>

Could I get a specific example? I understand the basics of what you’re saying but I don’t know how to execute that

---

<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: [May 4, 2026, 5:42am UTC](https://forum.makecode.com/t/how-to-select-something-specific-from-an-array/43805/6 "2026-05-04T05:42:20Z")

</div>

what i like to do is use the extension Sprite Data (you can find it in the default list). When creating the cards, set a number value for each one, corresponding to their order (1 - 7). Set up another sprite data for what player the card belongs to (1 or 2)

Make a variable called _selection_  
when pressing L or R, change this variable by 1 or -1 (also make sure that you cant make the number -1 or greater than 6) This is the number that will correspond to the selected card.

Make a function to visually update the given sprite. This will be the updated form of the selected card. Make sure you code in the unselection of any previously selected cards as well.  
To obtain the correct sprite input, use the get value from array of the card sprite kinds. This will run through every single card. But by setting an if statement to sort for the card data that = the _selection_ variable, we only get 1 card. This one card is the “selected” card who’s card data corresponds to the “selection” variable.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/c/d/cd93324fbec8a0b5f8266aebb2ec6af4c22dafb8.png)  
(here i just increased the scale and the z value to make it larger and appear on top of other cards)

Bringing it together, place the function in the on L and R press.

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

this is actually descibing how i coded the card selection for [Card Delver](https://forum.makecode.com/t/card-delver/41695) lmao so PLS do not copy the code exactly with the values as it is not going to translate 1 to 1

---

<div class="post-metadata">

### Author: ![xInsqne1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/xinsqne1/32/34060_2.png) [@xInsqne1](https://forum.makecode.com/u/xInsqne1)
#### Post date: [May 4, 2026, 4:42pm UTC](https://forum.makecode.com/t/how-to-select-something-specific-from-an-array/43805/7 "2026-05-04T16:42:30Z")

</div>

Thanks to @Luke I have a (mostly) working card selection setup! I haven’t actually made the logic behind putting a card into the middle, but I now need help with a new issue… I can’t seem to remove the card from being “highlighted”. Can someone help me again?

---

<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: [May 4, 2026, 7:14pm UTC](https://forum.makecode.com/t/how-to-select-something-specific-from-an-array/43805/8 "2026-05-04T19:14:06Z")

</div>

yay congrats! Another thing you can do with sprite data is store what type of card you are using. So I like to store the original card image and retrieve it when i need to use it to reset the selected card back to normal.

if that doesn’t apply feel free to tell me more about how you made the card “selected” that would be super helpful.

---

<div class="post-metadata">

### Author: ![xInsqne1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/xinsqne1/32/34060_2.png) [@xInsqne1](https://forum.makecode.com/u/xInsqne1)
#### Post date: [May 4, 2026, 11:36pm UTC](https://forum.makecode.com/t/how-to-select-something-specific-from-an-array/43805/9 "2026-05-04T23:36:36Z")

</div>

Sure! Here is a few screen shots and the game

> **[Card Game \[Made on 5/2/2026\] v1.2](https://arcade.makecode.com/S78196-24908-89385-84751)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/7/d/7d0c4365fa1d1e8bc5a88813035212705c596d65.png)

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

---

<div class="post-metadata">

### Author: ![xInsqne1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/xinsqne1/32/34060_2.png) [@xInsqne1](https://forum.makecode.com/u/xInsqne1)
#### Post date: [May 4, 2026, 11:41pm UTC](https://forum.makecode.com/t/how-to-select-something-specific-from-an-array/43805/10 "2026-05-04T23:41:01Z")

</div>

Woah thanks! This is just what I needed! I appreciate you taking the time to make this for me

---

<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: [May 5, 2026, 3:09am UTC](https://forum.makecode.com/t/how-to-select-something-specific-from-an-array/43805/11 "2026-05-05T03:09:15Z")

</div>

kinda off topic but I love the new flow of card games
