Discussion and feedback on Construct 2

### » Sun Oct 21, 2012 7:44 pm

Hi,

Is Sprite.Bullet.AngleOfMotion supposed to return a number between -180 and 180?

Sprite.Angle returns a number between 0 and 360.

I just think it's a bit confusing, I kinda expected it to return a value between 0 and 360. If it is supposed to do this then please mention it in the manual. :)

Example capxsoren2012-10-21 19:49:02
B
31
S
6
G
1
Posts: 19
Reputation: 3,828

### » Sun Oct 21, 2012 10:20 pm

Is it especially important? An angle of -90 is mathematically equivalent to an angle of 270.
Scirra Founder
B
362
S
216
G
75
Posts: 23,120
Reputation: 180,504

### » Mon Oct 22, 2012 6:12 am

Yes, I understand that. But if you want to check if AngleOfMotion > 270 you have to check if AngleOfMotion is > -90. That's not a problem in itself unless it's not mentioned anywhere that AngleOfMotion is a value between -180 and 180.. :-)soren2012-10-22 06:13:57
B
31
S
6
G
1
Posts: 19
Reputation: 3,828

### » Mon Oct 22, 2012 6:48 am

Oh cool, that's good to know.
B
135
S
65
G
17
Posts: 1,766
Reputation: 19,727

### » Mon Oct 22, 2012 1:33 pm

@soren - you should never make angle comparisons like that, because it doesn't understand the fact different angles are mathematically identical. Rely on the 'is clockwise' condition instead.
Scirra Founder
B
362
S
216
G
75
Posts: 23,120
Reputation: 180,504

### » Mon Oct 22, 2012 6:35 pm

You can convert it to 0-360 like so:
(Sprite.Bullet.AngleOfMotion + 360) % 360
B
82
S
26
G
62
Posts: 4,838
Reputation: 45,216

### » Mon Oct 22, 2012 6:39 pm

@Ashley, but 'is clockwise' is only for the object's angle, right? There's no equivalent for Bullet.AngleOfMotion, is there?soren2012-10-22 18:40:44
B
31
S
6
G
1
Posts: 19
Reputation: 3,828

### » Mon Oct 22, 2012 10:51 pm

For bullet behaviour you can have the sprite have an angle independent from the AOM, so using the sprite angle conditions won't help.
B
135
S
65
G
17
Posts: 1,766
Reputation: 19,727