# Flappy Bird Pipe generat

#1

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

``````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;
// }
//}
}
``````
1 Like
#2

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

``````</> 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?