I'm trying to create a system, where a bunch of equally-spaced "Line" sprites keep their distance to a "Player" sprite and constantly face it, except when the "Player" moves forward/backward relative to its heading - then the distance will increase/decrease.
I have a system working, using 0,0 as a reference point by which all the distance data is calculated... Problem is it only works in the 0-90 degrees range of "Player" angle.
I believe that I need to flip the reference point horizontaly/verticaly/both based on the "Player" angle, but as to how eludes me.
Here's a zipped .cap file is anyone would be willing to help out - much appreciated.
The data for the "Line" spacing and the maximum distance a "Line" can be at before being put back at the beginning of the sequence is inside the Data text object as a private variable. Each "Line" also has a Distance variable which stores the distance for the current loop, for final position calculation.
sendspace.com/file/c2el80
As a footnote, I had a second system for achieving the same result which used a delta of previous and current "Player" positions to calculate the distance change, but I ran into precision problems - so I hope to use this approach, with your input.
Thanks.