Sprite-aligned rotation problem

This forum is currently in read-only mode.
From the Asset Store
For problem solving, puzzles, bubbles, platforms and other adventures.
  • 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.

  • Is this the effect you were looking for? I used a slightly different approach.

    http://dl.dropbox.com/u/5426011/fixed/Funky%20Koval.cap

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thank you. Yes, this is exactly what I'm after.

    And this method is similar to the alternative one I wrote...

    Now I see that the "precision" problems I had weren't really related to accuracy - unlike you, I was calculating the distance without regard to the "Player" heading, which was throwing my results off.

    Again, thank you.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)