Standardized Angle of Motion

0 favourites
  • 4 posts
From the Asset Store
Complete the collection by purchasing Motion Universe Pt. 2
  • I've noticed that the way each method of moving an object has a completely different way of handling angle of motion.

    For instance in 8-Directional movement, it measures the movement angle in an increment of 0 to 180 for downward-moving things and 0 to -180 for upward-moving things, while in the Pathfinding behavior, angle of motion is measured in 360 degrees.

    Why is this?

    Is this something that can be standardized?

  • It shouldn't be important. 270 is the same angle as -90.

  • It /shouldn't/ be important, but the only reason I noticed it was because it /was/ causing my animations to glitch.

    My game involves switching between three different characters. You move the Active character using the 8-directional behavior, and the two inactive characters follow you with the pathfinding behavior.

    Because of the switching, I have to make separate cases for animations for if they're moving with 8-directional or pathfinding. I determine which animation to play (up, right, left, down) by using the MovingAngle expression in each behavior.

    Now, I thought I could just copy the code, because it would be the same, but it turns out I had to change the range of angles for each, since one uses a 0 to 180 and 0 to -180 scale and the other uses a 0 to 360 scale.

    It wasn't a HUGE deal, but it's still weird and took a bit to figure out what was going on.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you're making linear comparisons, you shouldn't be, because they don't respect the cyclical nature of angles. You should stick to the angle-specific conditions like 'Is within angle'.

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