Angle range?

For questions about using Classic.

Post » Sun Apr 05, 2009 7:42 am

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!
Image ImageImage
B
165
S
49
G
147
Posts: 8,048
Reputation: 96,588

Post » Sun Apr 05, 2009 9:04 am

the cap shows what I'm about to say
[u:2iro1rpi]click me to download cap[/u:2iro1rpi]
but

[code:2iro1rpi]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]
Spriter Dev
B
96
S
21
G
12
Posts: 3,259
Reputation: 16,819

Post » Sun Apr 05, 2009 10:01 am

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. :oops:

Thanks, I do believe that will fix it!
Image ImageImage
B
165
S
49
G
147
Posts: 8,048
Reputation: 96,588

Post » Sun Apr 05, 2009 10:03 am

[quote="newt":1bw7fgbp]Thats ok cause I didnt even know there was a system between. :oops: [/quote:1bw7fgbp]

Going to have to say, neither did I!
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Sun Apr 05, 2009 1:36 pm

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.
Scirra Founder
B
382
S
223
G
86
Posts: 23,998
Reputation: 189,773

Post » Sun Apr 05, 2009 8:04 pm

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? :shock:

The 360/0 thing has been plaguing me to no end, and I've had to make some really crude workarounds :(
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sun Apr 05, 2009 8:59 pm

Yeah, I gotta try something else, seems system compare is doing something buggy with family compare.
Image ImageImage
B
165
S
49
G
147
Posts: 8,048
Reputation: 96,588


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 6 guests