# Asking for value but sets value to

**URL:** https://forum.makecode.com/t/asking-for-value-but-sets-value-to/4471
**Category:** Help
**Created:** [November 17, 2020, 5:23pm UTC](https://forum.makecode.com/t/asking-for-value-but-sets-value-to/4471 "2020-11-17T17:23:54Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)
#### Post date: [November 17, 2020, 5:23pm UTC](https://forum.makecode.com/t/asking-for-value-but-sets-value-to/4471/1 "2020-11-17T17:23:54Z")

</div>

> **[War Subs](https://arcade.makecode.com/77355-44232-22914-31496)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

(look at the end of the start block)

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

I am setting the enemy base’s image to a random value from my “Bases” array.  
I am then flipping the image and changing the colors (I am doing this to make it look like an enemy submarine). It does that, but as I change the enemy base’s image, it also changes the image in my “Bases” array. By the way, the base is like the hull of the ship. How can I prevent it from changing the image in my array?

Also, this is my game for the Jam, please don’t copy it.

- Game God

---

<div class="post-metadata">

### Author: ![shakao](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/shakao/32/113_2.png) [@shakao](https://forum.makecode.com/u/shakao)
#### Post date: [November 17, 2020, 5:35pm UTC](https://forum.makecode.com/t/asking-for-value-but-sets-value-to/4471/2 "2020-11-17T17:35:50Z")

</div>

Oh yeah, so this is a little bit of Arcade trickery–when you pick the image from the Bases array, it doesn’t make a copy of the image, it just points to the image that lives in the array. So when you do “flip EnemyBase image” there’s only one underlying “image” object; the sprite image is also the image in the Bases array.

You can get around this by using the “clone picture” block from the Images category:

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

Which will make a copy of the Base image and change that instead of the one in the array. Be careful when using “clone”, though, a lot of large images can slow a game down!

(Also this looks _incredible_, I can’t wait to see your final game!)

---

<div class="post-metadata">

### Author: ![Kat](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/kat/32/2596_2.png) [@Kat](https://forum.makecode.com/u/Kat)
#### Post date: [November 17, 2020, 5:44pm UTC](https://forum.makecode.com/t/asking-for-value-but-sets-value-to/4471/3 "2020-11-17T17:44:13Z")

</div>

HOLY COW!!! THE ART ON THIS IS BEAUTIFUL!!!

👉 👈 also- how did you do the character “skin” selection screen?

---

<div class="post-metadata">

### Author: ![GameGod](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/gamegod/32/2756_2.png) [@GameGod](https://forum.makecode.com/u/GameGod)
#### Post date: [November 17, 2020, 6:23pm UTC](https://forum.makecode.com/t/asking-for-value-but-sets-value-to/4471/4 "2020-11-17T18:23:29Z")

</div>

> [@Kat](#):
>
> HOLY COW!!! THE ART ON THIS IS BEAUTIFUL!!!

> [@shakao](#):
>
> (Also this looks _incredible_ , I can’t wait to see your final game!)

Thanks!

> [@Kat](#):
>
> 👉 👈 also- how did you do the character “skin” selection screen?

For the menu, I just made a 160x120 sprite and gave it a low depth (z). For the selector, I made a sprite that changes size depending on its position and a variable called “CursorPosition”. Search my code for it (yes, I know my code is messy).

---

<div class="post-metadata">

### Author: ![Kat](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/kat/32/2596_2.png) [@Kat](https://forum.makecode.com/u/Kat)
#### Post date: [November 17, 2020, 6:29pm UTC](https://forum.makecode.com/t/asking-for-value-but-sets-value-to/4471/5 "2020-11-17T18:29:15Z")

</div>

Thanks!
