Angles in Degrees

  • Anybody know of a quick way to have an angle displayed as a degree, rather than a minus.

    By degree, I mean an arrow facing directly up would be 270, rather than -90. This also means that if an object rotates completely 10 times, rather than returning a result of 3600, I can instead be presented with a 0. So 0 and 360 are exactly the same, and if an object rotates anti-clockwise a single degree, I'll see 359 rather than -1.

    Hope I've made sense!!!

  • This will work where your angle is coming from the angle expression. Where X is your angle and -180 <= X <= 180, using a conditional expression.

    NiceAngle = X > 0 ? X : 360 + X[/code:3d1hpa1g]
    Which translates equivalently to the statement(not usable, this is just for demonstration purposes):
    [code:3d1hpa1g]NiceAngle = X if X > 0 else (360 + X)[/code:3d1hpa1g]
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Great! I'll give it a go first thing in the morning! I rarely use conditional expressions like this (if ever, thinking about it), so I'll do my best to get this sorted.

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