I need some help collision checking if Link is within the path of an angle...or put in other words; If one were to use a Screen drawing function to form a line from the top-right to the bottom-left of the screen, How could we check if Link is within this scope?
To make this more interesting, there are a few of these at work all rotating clockwise. To simplify this, I assumed that each one rotates from its center at 138,80, and a degree is incremented each frame. (n)
So far I cannot match the angle at all, and my script seems random. This is the best I got:
int lx = Link->X;
int ly = Link->Y; for(int i=8;i<138;i+=8){
if(black){
int radx = 138 + (i * Sin(n));
int rady = r + (i * Cos(n));
if(Abs(lx-radx)<10&&Abs(ly-rady)<10){Link->HP--;Game->PlaySound(11);}
}
else if(white){
int radx = 138 + (i * Sin(n+90));
int rady = r + (i * Cos(n+90));
if(Abs(lx-radx)<10&&Abs(ly-rady)<10){Link->HP--;Game->PlaySound(11);}
}
}
Hooboy...