# Flappy Bird pipe generate

**URL:** <https://discourse.processing.org/t/flappy-bird-pipe-generate/11059>\
**Category:** Coding Questions\
**Created:** [May 9, 2019, 10:08am UTC](https://discourse.processing.org/t/flappy-bird-pipe-generate/11059 "2019-05-09T10:08:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![totolepeco](https://avatars.discourse-cdn.com/v4/letter/t/7bcc69/32.png) [@totolepeco](https://discourse.processing.org/u/totolepeco)\
**Post date:** [May 9, 2019, 10:08am UTC](https://discourse.processing.org/t/flappy-bird-pipe-generate/11059/1 "2019-05-09T10:08:06Z")

</div>

Hello, I’m young French student, and for my scientific secondary school diploma, I must making a little game. I have choosen so to make a Flappy Bird.  
I successfully to make the random pipe, but I would like to generat more than one.

Please could you help me ?

Thank’s

Ps: Sorry for my English but I learn in France ! 😂

My code

```auto
var xt = 800; //coordonnées x du tuyau
var nt =0; //nombre de tuyau qui spawn
var yt; //coordonnées de la hauteur du tuyau

function setup() {
  createCanvas(800, 500); //création de canvas 
  yt = random(50,390); //choix random de la hauteur du tuyau
}

function dessinpipe(yt){

  stroke (0); //contour noir
  fill(0,220,0); //rmeplir en vert
  rect(xt,-2,40,yt); //dessin du haut du pipe (x1,y1,largeur,hauteur)
  rect(xt,yt+100,40,2000); //dessin du bas du pipe
  
  stroke (100,255,100); // luminosité pipe du haut 
  fill (100,255,100);
  rect(xt+5,0,5,yt);
  stroke (0,180,0);
  fill (0,180,0);
  rect(xt+33,0,5,yt);
  stroke (0,180,0);
  fill (0,180,0);
  rect(xt+28,0,2,yt);
  
  stroke (100,255,100); // luminosité pipe du bas
  fill (100,255,100);
  rect(xt+5,yt+100,5,2000);
  stroke (0,180,0);
  fill (0,180,0);
  rect(xt+33,yt+100,5,2000);
  stroke (0,180,0);
  fill (0,180,0);
  rect(xt+28,yt+100,2,2000);
  
  stroke (0); //rectangle du pipe
  fill(0,220,0); 
  rect(xt-5,yt-20,50,20); // bas
  rect(xt-5,yt+100,50,20); // haut
  }

function draw() {
  background(222); //fond gris         
 
 // while(nt<5){
 // dessinpipe(yt); //appel de la fonction dessin du pipe
    
  
     if(xt>-1000){
     dessinpipe(yt); 
     xt=xt-3; //déplacement du pipe
       
  }
  nt=nt+1;
    
 // else if (xt>=-41){
  // xt=800;
 // }  
 //}   
}

```

---

<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:** [May 9, 2019, 10:12am UTC](https://discourse.processing.org/t/flappy-bird-pipe-generate/11059/2 "2019-05-09T10:12:07Z")

</div>

-a- can you repair your post and format your code using the

```auto
</> code tag

```

-b- did you search the forum and read all posts regarding  
flappy bird examples from other users  
to get ideas how to approach your question?
