Angle range?

This forum is currently in read-only mode.
  • Say you have one event you want to pick two different ranges of angles from, like left and right, but a little more complicated. I need to have one event that checks that an angle is between 315, and 45, or 135, and 225. Basically left and right, with out a top and bottom.

    Like if you were looking at a clock if its between 2 and 4 o'clock, or 8 and 10 o'clock do something.

    Initially I started with angle compare of angle is greater than 315, or less than 45... that works great for the right side, but since I need this in the same event I need to add a left side. Thing is when I add angle is greater than 135, or less than 225 Im basically saying if the angle is greater than zero, and less than 360 do this.

    Is there a way to compare a angle range without using </>, and also how the heck do I deal with one of those ranges being between 90, and 315?

    I know if it was set up with 0 degrees at the top it would be a little easier, but then again Im going to have to set up another event that does the opposite, and picks top and bottom.

    Any ways HELP!

  • the cap shows what I'm about to say

    click me to download cap

    but

    system - is number (sprite.angle) between (135) and (225)
    system - OR
    sprite - compare angle (less than) (45)
    system - OR
    sprite - compare angle (greater than) (315)[/code:2iro1rpi]
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • See now I wouldn't have even thought to mix sprite compare with system compare.

    Thats ok cause I didnt even know there was a system between.

    Thanks, I do believe that will fix it!

  • Thats ok cause I didnt even know there was a system between.

    Going to have to say, neither did I!

  • There are built in functions for handling angle comparisons. Don't use the ordinary compare less than/greater than. They won't take in to account the 0 degrees/360 degrees crossover point, nor will it know that 410 degrees is wrapped around and becomes 50 degrees.

  • What are these functions and why do I not know about them when I am making a game that relies heavily on changing the angle of, well, everything?

    The 360/0 thing has been plaguing me to no end, and I've had to make some really crude workarounds

  • Yeah, I gotta try something else, seems system compare is doing something buggy with family compare.

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