PDA

View Full Version : Soccer help please!


Komieko
04-15-2001, 08:55 AM
How would I edit this so that it can go everywhere and not hit invisible objects as if it were in the tygcpolo area which I dun like :P (playerenters) {
timeout=0.05;
}

if(timeout){
ballx=x;
bally=y;
for(this.i=0;this.i<playerscount;this.i++){
if(abs(x-players[this.i].x)<=2&&abs(y-players[this.i].y)<=2&&!strequals(#n(this.i),)&&abs(this.xspeed)<=0.25&&abs(this.yspeed)<=0.75){
this.xspeed=x-players[this.i].x;
this.yspeed=y-players[this.i].y;
}
}
if(abs(this.xspeed)>0.01){
this.xspeed*=0.9;
if((x+this.xspeed)<44.5&&(x+this.xspeed)>20.5) x+=this.xspeed;
else this.xspeed*=-1;
this.xspeed+=random(-0.001,0.001);
}//else this.xspeed=0;
if(abs(this.yspeed)>0.01){
this.yspeed*=0.9;
if((y+this.yspeed)<49&&(y+this.yspeed)>12) y+=this.yspeed;
else this.yspeed*=-1;
this.yspeed+=random(-0.001,0.001);
}//else this.yspeed=0;

if(x>30.5&&x<32.5){
if(y<13){
x=30.5;
y=29.5;
this.xspeed=0;
this.yspeed=0;
npcs[1].timeout=0.05;
redscore++;
}else if(y>48){
x=30.5;
y=29.5;
this.xspeed=0;
this.yspeed=0;
npcs[2].timeout=0.05;
bluescore++;
}
}

if(abs(this.xspeed)>0.5||abs(this.yspeed)>0.5){
showimg 0,charshadow.gif,x+0.5,y+1.5;
hide;
}else{
hideimg 0;
show;
}
showimg 1,ball.png,x+0.6,(y+1)-((abs(this.xspeed)+abs(this.yspeed))*0.5);
timeout=0.05;
}

Tyhm
04-15-2001, 10:18 AM
Mou, where'd you get that?

Komieko
04-15-2001, 10:35 AM
PANTS!