0 Favourites

# angle() expression problem D:

• 4 posts
• Okay I'm aware there's been quite a few questions relating to angles and rotation recently, but I did a search and couldn't find anything regarding this specifically...

<img src="http://dl.dropbox.com/u/53374990/angle%20problem.png" border="0" />

As you probably already know, using the "angle" expression... [angle(x1, y1, x2, y2)] returns an angle based on the circle on the left.. (if x1,y1 was in the centre of the circle)

But my question is how would you go about rotating this? along with the 180 to -180 cut off point?

So if I wanted it to rotate 90 degrees for example, it would give the values shown in the second Circle.

• Subtract 90 degrees from angle- this should cover most cases

Outside of range? add 360 degrees

Using expression you could do this:

set var= angle(x1,y1,x2,y2) - 90

set var= (var<-180) ? var : var+360

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

Construct 3 users don't see these ads
• I think it might actually be:

var = angle + 90

var = (var >= 180 ? var - 360 : var)

• I had actually tried doing this but assumed it wasn't right because what i was trying to achieve didn't work.. I brushed it aside and made the problem more complex in my head .. (but your reply made me revisit it and I found out just now it didn't work because of how i'd set up other events and vars)

..(also because i'm a dumbass)

thanks guys :)

• 4 posts