# Trying to ensure that one item spawns at a time

**URL:** <https://discourse.processing.org/t/trying-to-ensure-that-one-item-spawns-at-a-time/24745>\
**Category:** Coding Questions\
**Created:** [October 20, 2020, 12:10pm UTC](https://discourse.processing.org/t/trying-to-ensure-that-one-item-spawns-at-a-time/24745 "2020-10-20T12:10:33Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jxjohn](https://avatars.discourse-cdn.com/v4/letter/j/3ec8ea/32.png) [@jxjohn](https://discourse.processing.org/u/jxjohn)\
**Post date:** [October 20, 2020, 12:10pm UTC](https://discourse.processing.org/t/trying-to-ensure-that-one-item-spawns-at-a-time/24745/1 "2020-10-20T12:10:33Z")

</div>

Hi, I’m trying to say when an enemy disappear from the screen it will move from 1 array to the next while maintaining the previous shape it has already drew. However, whenever I run the code it seems to draw all the arrays for me.  
Can someone help me trouble shoot this and tell me what to add or change thx.

```auto
float [][] Mpos = new float [4][2];
if (enemyexit == true) {
    for (int i = 0; i< Mpos.length; i++) {
      for (int j =0; j<Mpos[i].length; j++) {
        Mpos[0][0]= random(120, 150);
        Mpos[0][1]= random(-150, 120);
        Mpos[1][0]= random(-120, -150);
        Mpos[1][1]= random(-150, 120);
        Mpos[2][0]= random(-150, 150);
        Mpos[2][1]= random(-120, -150);
        Mpos[3][0]= random(-150, 150);
        Mpos[3][1]= random(100, 120);
      
      minicreature(mouseX+Mpos[i][0], mouseY+Mpos[i][1]);
```

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [October 21, 2020, 7:52am UTC](https://discourse.processing.org/t/trying-to-ensure-that-one-item-spawns-at-a-time/24745/2 "2020-10-21T07:52:47Z")

</div>

> [@jxjohn](#):
>
> it will move from 1 array to the next

What next? I just see one double array receiving random values every enemyexit.

---

<div class="post-metadata">

**Author:** ![jxjohn](https://avatars.discourse-cdn.com/v4/letter/j/3ec8ea/32.png) [@jxjohn](https://discourse.processing.org/u/jxjohn)\
**Post date:** [October 21, 2020, 10:04am UTC](https://discourse.processing.org/t/trying-to-ensure-that-one-item-spawns-at-a-time/24745/3 "2020-10-21T10:04:59Z")

</div>

I meant from the first values in the array to the next value in the same array

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [October 21, 2020, 10:19am UTC](https://discourse.processing.org/t/trying-to-ensure-that-one-item-spawns-at-a-time/24745/4 "2020-10-21T10:19:14Z")

</div>

I understand, but like I said you are filling all indexes in the double array with random values, not transferring anything.

---

<div class="post-metadata">

**Author:** ![jxjohn](https://avatars.discourse-cdn.com/v4/letter/j/3ec8ea/32.png) [@jxjohn](https://discourse.processing.org/u/jxjohn)\
**Post date:** [October 21, 2020, 10:46am UTC](https://discourse.processing.org/t/trying-to-ensure-that-one-item-spawns-at-a-time/24745/5 "2020-10-21T10:46:05Z")

</div>

Actually I want to values to be used in my mini creature x and y position
