I’m wondering what else I need so this works with multiple players in the level, and why?

[CODE]if(playerenters){

dontblock;

setimgpart baddy_bird01.png,96,0,48,32;

this.originx = 33;

this.originy = 24;

this.speed = .5;

timereverywhere;

timeout = .05;

}

if(timeout){

if(this.dead=0){

//direction to look at

if(this.goingback==0){

this.dx = playerx-x;

this.dy = playery-y;

this.dir = getdir(this.dx,this.dy);

}

if(this.goingback==1){

this.dx = this.originx-x;

this.dy = this.originy-y;

this.dir = getdir(this.dx,this.dy);

}

```
//movement
checkifplayernearby();
if(this.attacking == 0&&this.goingback == 0){
lookatplayer();
}
if(this.attacking == 1){
fly();
attackplayer();
}
if(this.attacking == 0 && this.goingback==1){
fly();
goback();
}
hurtplayer();
```

}

else{

this.c++;

if(this.c==20)destroy;

}

timeout = .05;

}

if(hitbyboomerang){

this.dead = 1;

setcharani baddy_dead_01,;

}

function lookatplayer(){

if(this.dir==0) setimgpart baddy_bird01.png,0,0,48,32;

if(this.dir==1) setimgpart baddy_bird01.png,48,0,48,32;

if(this.dir==2) setimgpart baddy_bird01.png,96,0,48,32;

if(this.dir==3) setimgpart baddy_bird01.png,144,0,48,32;

}

function checkifplayernearby(){

if(playerx in |this.originx-5,this.originx+5|

&&playery in |this.originy-4,this.originy+12|){this.attacking = 1; this.goingback=0;}

else if(this.attacking==1) {this.attacking = 0; this.goingback=1;}

}

function fly(){

this.i++;

if(this.dir==0){

if(this.i%6==0) setimgpart baddy_bird01.png,0,32,48,32;

if(this.i%6==2) setimgpart baddy_bird01.png,0,64,48,32;

if(this.i%6==4) setimgpart baddy_bird01.png,0,96,48,32;

}

if(this.dir==1){

if(this.i%6==0) setimgpart baddy_bird01.png,48,32,48,32;

if(this.i%6==2) setimgpart baddy_bird01.png,48,64,48,32;

if(this.i%6==4) setimgpart baddy_bird01.png,48,96,48,32;

}

if(this.dir==2){

if(this.i%6==0) setimgpart baddy_bird01.png,96,32,48,32;

if(this.i%6==2) setimgpart baddy_bird01.png,96,64,48,32;

if(this.i%6==4) setimgpart baddy_bird01.png,96,96,48,32;

}

if(this.dir==3){

if(this.i%6==0) setimgpart baddy_bird01.png,144,32,48,32;

if(this.i%6==2) setimgpart baddy_bird01.png,144,64,48,32;

if(this.i%6==4) setimgpart baddy_bird01.png,144,96,48,32;

}

}

function attackplayer(){

if(this.takeback==0){

this.dist=(this.dx^2+this.dy^2)^.5;

if(this.dist>1){

x += (this.dx/this.dist)*this.speed;

y += (this.dy/this.dist)*this.speed;

}

else this.takeback = 1;

}

//so the bird backs up before attacking again

if(this.takeback==1&&this.b%7<=5){

this.dx = this.originx-x;

this.dy = this.originy-y;

goback();

this.b++;

}

else{this.takeback=0; this.b=0}

}

function hurtplayer(){

for (this.x=1;this.x<=2;this.x+=.5){

for (this.y=1;this.y<=2;this.y+=.5){

hitplayer testplayer(x+this.x,y+this.y),1,x,y;

}

}

}

function goback(){

this.dist=(this.dx^2+this.dy^2)^.5;

if(this.dist>1){

x += (this.dx/this.dist)*this.speed;

y += (this.dy/this.dist)*this.speed;

}

else this.goingback = 0;

}[/CODE]