angle() function question

0 favourites
From the Asset Store
3D Car Pack 1
$2.99 USD
3D models + Rendered Low-Poly Cars in isometric, top-down, and side angles.
  • Construct 2 is working correctly, the problem is your own comparisons. -135 degrees is mathematically identical to +225 degrees, so both answers are equally correct. The problem is you are making linear comparisons that are not aware of the cyclical property of angles. You are expecting only one of the possible set of correct answers.

    Use the Sprite object's angle conditions instead, which are cycle-aware - for example "is within 90 degrees of 0 degrees" will match anything in the -90 to +90 degree range, or +270 to +90, or +270 to +450, etc. since they are all mathematically identical ranges and the math used in the condition is cycle-aware. Funnily enough this exact issue came up on the forums recently and I realise not everyone uses the Sprite object for this type of thing so the next beta should have those features as system conditions as well.

    Thanks Ashley

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)