Phantom Hourglass Phantoms
#16
Posted 10 January 2010 - 08:22 AM
#17
Posted 10 January 2010 - 09:11 AM
void run(int radius, int enemy, int spawn){
ffc f = this;
if(spawn != 0) f = Screen->LoadFFC(spawn);
while(!LineOfSight(f) || Distance(f->X,f->Y,Link->X,Link->Y) > radius || ComboFI(Link->X+8,Link->Y+8,CF_NOENEMY)) Waitframe();
CreateNPCAt(enemy,f->X,f->Y);
f->Data = 0;
}
bool LineOfSight(ffc f){
float angle = RadianAngle(f->X,f->Y,Link->X,Link->Y);
int dir = VelToDir(f);
return ((Abs(angle) <= PI/4 && dir == DIR_RIGHT) || (Abs(angle) >= 3*PI/4 && dir == DIR_LEFT)
|| (angle >= PI/4 && angle <= 3*PI/4 && dir == DIR_UP) || (angle <= -PI/4 && angle >= -3*PI/4 && dir == DIR_DOWN));
}
bool ComboFI(int x, int y, int flag){
int loc = ComboAt(x,y);
return (Screen->ComboF[loc] == flag || Screen->ComboI[loc] == flag);
}
int VelToDir(ffc f){
if(Abs(f->Vy) > Abs(f->Vx)){
if(f->Vy < 0) return DIR_UP;
else return DIR_DOWN;
}else{
if(f->Vx < 0) return DIR_LEFT;
else return DIR_RIGHT;
}
return -1;
}
}
#18
Posted 10 January 2010 - 11:18 AM
Can you fix this?
Edited by theZCking, 10 January 2010 - 11:18 AM.
#19
Posted 10 January 2010 - 11:24 AM
#20
Posted 10 January 2010 - 11:36 AM
#21
Posted 10 January 2010 - 11:45 AM
#22
Posted 10 January 2010 - 12:08 PM
#23
Posted 10 January 2010 - 12:33 PM
#24
Posted 11 January 2010 - 04:27 PM
#25
Posted 11 January 2010 - 06:36 PM
The ffc is the black circle, and the big circle is it's radius of vision.
When it's facing up, it can see the blue area. Down is red, left is yellow and right is green. If the script is doing anything differently from this, it's going wrong.
#26
Posted 11 January 2010 - 07:07 PM
#27
Posted 12 January 2010 - 05:12 AM
#28
Posted 12 January 2010 - 03:48 PM
#29
Posted 12 January 2010 - 04:20 PM
#30
Posted 12 January 2010 - 04:23 PM
The ffc is the black circle, and the big circle is it's radius of vision.
When it's facing up, it can see the blue area. Down is red, left is yellow and right is blue. If the script is doing anything differently from this, it's going wrong.
...and right is green. ...Right? Otherwise I'm confused. Not that I really understand it =p
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users