Thank you for your help! I dont really understand what youre saying there so i will try to explain what i want to achieve.
First a picture:
what i want, is to set the turret range to the distance of the turret (P[0/0]) and the point on the dotted line
this was my first approach:
quite complicated, hm? i dont know why, but it produced wright values for this particular "angle section" (even if i used the wrong angle to calculate var_x, or is it the wright angle? because when i change that it gets wrong results?)
Edit: while i was writing this post, i think i found my failure, the distancefactor of the turret (how many tiles around it) must be multiplied with the actual values of my formulas instead of multiplying the results?!
when i copyed this for the other angles and changed the calculation of alpha so i always get an angle between 0 and 90 it made a total mess.
now, like i said, my calculation is for the range of middle of tile (where the turret stands) to its (imaginary) border, so i thought i have to take this calculated "neutral" distance and have to make something like, set turret.range to distancevalue + numberoftileradius * distancevalue, or just distancevalue * 3 for an 1 tile radius.
heres what i did on paper http://fldr.de/DSC_0469.jpg , maybe it helps
this is how i calculated the values for 0-90° in the array:
my variables:
and how i set the range now:
and this is what it does: http://fldr.de/towerturret
only place one tower, if more are placed you never really know which distance the redline is presenting (i was sloppy with that) and dont forget to press A so theres something in the array (again i was sloppy with these debugging things <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink">)
Edit2: haha i just found another failure, for 90-180 and 270-360 i set the turret.range to the wrong values, for these angles i should mirror the values, wright?
but like i said before, my math skills arent good so i might do everything wrong here and what you where saying is just what i was trying to do?
Thanks!
Big Edit: i think i got a working solution, but im very open for better performing methods, now theres a "for each turret" event that fires every tick, first compares if the turret has an target and then setting range (and when it has no target also the angle) dependent on the turret.angle
http://fldr.de/towerdefense