How does "Clockwise from angle" work?

0 favourites
  • 4 posts
  • So this isn't really a problem per se, just wondering if I'm understanding this condition correctly. The way I took it, if angle X is closer to angle Y measuring clockwise, then it's true. Consequently, the inverse of this condition tests if angle X is closer counterclockwise. Manual seemingly confirms this.

    Anyway, I was using these conditions to make a sprite play different animations when it's clockwise/counterclockwise from another object, and it basically did what I wanted it to except that the conditions registered as exact opposites to what I expected. In other words, when the Sprite was facing upward and had the Object at around its 3 o'clock, it registered it as counterclockwise. When it had it around 9 o'clock, it registered it as clockwise.

    Of course the solution was to simply switch the conditions, but now I'm wondering if I'm understanding these conditions correctly.

  • Clockwise means it's a greater angle. 45 degrees is clockwise of 0 degrees. 45 degrees is counterclockwise of 90 degrees.

    It's the direction the clock hands move.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you are looking for the smallest difference between two angles, just if, then use this expression:

    anglediff(angle 1, angle 2)

  • On second thought it might not have been the fault of the conditions but the input. The angle I was testing was between two objects, i.e. angle(x1, y1, x2, y2), so perhaps it was testing the angle from the target object to the sprite, thus giving me inverse results. That'd make sense, heh.

    Anyway, thanks for the replies y'all.

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