I would like to know why angle() function goes into negatives after 180°. I would like it to go to 360° because my algorithm based on angle detected between an object and touch input fails for:

If value angle(x1,y1,x2,y2) is between values 135°&225° --->do something. it fails after 180°.

It also fails if i do: 135°&-135°

I figured this out with another way but again I have the feeling that this function is broken.

Please explain me.

Plus the angle values are invetrted compared to the normal angle behavior in construct. (I've included an image)

I used this logic and it didn't work. Past the 180° C2 was considering it's over the angle limit (maybe with the final else event but i don't see the point)

So basically once the angle did not match the width of the DragLine was returned to 0. And it happened at 180° instead of 225°. Because the angle started to decrementing. And i proved it with putting from 135to (-135) as the angle condition. The line even failed to appear so it has a problem with negative angles. Something is broken. I would like to know what.

But yeah I could simply covert the 180° ranged angles to a 360° and this will probably work. I was just surprised that C2 does not recognise -135° as 225°

just to draw a line from a start.X&start.Y to a perpendicular direction depending of the relative touch.x&touch.y position.

But it's okay i resolved the stuff. Would be cool if angle did automatically convert to a 360° based value automatically. I don't see the point of decrementing after 180°.

Plus the angles are inverted compared to the normal construct angles logic. with angle() 0 is where 180 normally is.

Next time i will just write my own angle() function that adds 360 in case that that you have a negative.

I think, for this instance, you would be better off determining if the "snapped" touch xy is greater than, less than etc of the initial touch position.

I think, for this instance, you would be better off determining if the "snapped" touch xy is greater than, less than etc of the initial touch position.

The angle serves no purpose.

Yep should work.

But again my angle logic should have worked with brute js code :p

It's okay I'm learning the limitations of some event stuff in c2

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.