xxxxxxxxxx
46
function Bird(images){
this.y = height/2;
this.x = width/2 ;
this.horse= images;
this.gravity= 0.9;
this.lift =-20 ;
this.velocity =0 ;
this.index = 0;
this.show = function(){
// fill(255);
// ellipse(this.x, this.y, 32,32);
image(this.horse[this.index],this.x,height/2-50);
this.index= (this.index+1)% this.horse.length;
image (this.horse, this.x, this.y, 32,32 );
}
this.up =function (){
this.velocity += this.lift;
//this.x = this.x-this.lift;
}
this.update = function (){
this.velocity +=this.gravity;
//this.velocity *=0.9;
this.y += this.velocity;
if(this.y> height-16){
this.y= height-16;
this.velocity = 0;
}
if(this.y> 300){
this.y= 300;
this.velocity = 0 ;
}
}
}