# Need help on a short animation

**URL:** https://discourse.processing.org/t/need-help-on-a-short-animation/5438
**Category:** Coding Questions
**Created:** [November 11, 2018, 11:53am UTC](https://discourse.processing.org/t/need-help-on-a-short-animation/5438 "2018-11-11T11:53:38Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Robin73](https://avatars.discourse-cdn.com/v4/letter/r/3ec8ea/32.png) [@Robin73](https://discourse.processing.org/u/Robin73)
#### Post date: [November 11, 2018, 11:53am UTC](https://discourse.processing.org/t/need-help-on-a-short-animation/5438/1 "2018-11-11T11:53:38Z")

</div>

so i had in mind to make spawn 3000 pac man at the same time in random (x;y) and i want them to go on the right. But when i try only one spawn in random(x;y) and he is nice going on the right but i can’t make spawn 3000 of them. Here’s the code where i only tried to make spawn 10 of them :

float[] x=new float[3000];  
float[] y=new float[3000];

int r;  
void setup() {  
size(1000,1000);  
noStroke();

for(int r=0 ; r\<10 ; r+=1){

x[r]=random(1000);  
y[r]=random(1000);

}  
}  
void draw() {  
background(0);

x[r]+=1;  
fill(255,255,0);  
arc(x[r],y[r],20,20,0.52,5.76);

}

---

<div class="post-metadata">

### Author: ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)
#### Post date: [November 11, 2018, 12:11pm UTC](https://discourse.processing.org/t/need-help-on-a-short-animation/5438/2 "2018-11-11T12:11:54Z")

</div>

yes, you only draw 1, why not draw all?

```auto
int howMany = 50; // 3000

float[] x=new float[howMany];
float[] y=new float[howMany];

void setup() {
  size(500, 500);
  noStroke();
  for (int r=0; r<howMany; r++) {
    x[r]=random(500);
    y[r]=random(500);
  }
}

void draw() {
  background(0, 0, 50);
  fill(255, 255, 0);
  for (int r=0; r<howMany; r++) {
    fill(255, 255, 0);
    arc(x[r], y[r], 20, 20, 0.52, 5.76);
    fill(255, 0, 0);
    ellipse(x[r]+3, y[r]-5, 4, 4);
    x[r]+=1;
    // this could help: if ( x[r] > width ) x[r] = 0;
  }
}

```

---

<div class="post-metadata">

### Author: ![Robin73](https://avatars.discourse-cdn.com/v4/letter/r/3ec8ea/32.png) [@Robin73](https://discourse.processing.org/u/Robin73)
#### Post date: [November 11, 2018, 12:24pm UTC](https://discourse.processing.org/t/need-help-on-a-short-animation/5438/3 "2018-11-11T12:24:44Z")

</div>

Thank you so much i’m new in processing and so i did not understand i have to put the loop “for” in draw and in the setup. And thx for being so fast to reply. I wish u a wonderfull day.
