When to use Angle attribute?

SlowboySlowboy Member, PRO Posts: 329
edited July 2012 in Working with GS (Mac)
Hi All, random question!...
I usually just use Real attributes and adjust the rotation of an object, but am I missing a trick by not using an Angle attribute instead? Is there a particular advantage or quirk of the Angle attribute that makes it easier or more efficient to use when dealing with an object's rotation? Any advise much appreciated as I don't really know anything about Angle?
Cheers
Wayne

Comments

  • MarkOnTheIronMarkOnTheIron Member Posts: 1,447
    If I remember correctly the angle attribute can hold a maximum value of 360 and if it's bigger it will restart from 0. So a value of 380 with the angle attribute will be 20.

    It can be useful when working with angles. Personally I never used it, but you never know :)

  • SlowboySlowboy Member, PRO Posts: 329
    Thanks Mark, that does sound useful - I'm still too scared to try it though ;]
  • FloridaGamesFloridaGames Member Posts: 328
    So a value of 380 with the angle attribute will be 20.


    Keep in mind that if you use a real attribute (game.anlge) and then have actor do something like : change self.rotation to game.angle.
    and game.angle does equal 380 it would still act like 20 in the behavior/action.
    So really, theres pretty much no difference. I would just keep using real attributes.
  • NovicaStudioNovicaStudio Member Posts: 174
    @FloridaGames although I think the Angle Type of Attribute would reduce a bit of lag if you had something like 3600000 as a real, an angle could reduce it. I think it might help a bit. Plus you could have an angle attribute in your game :-O
  • FloridaGamesFloridaGames Member Posts: 328
    ahh touche @novicaStudio, I never thought of that. They might be worth using afterall.
  • SlowboySlowboy Member, PRO Posts: 329
    Thanks for the insight all! It looks like I'll manage without them!
    The only angle based issue I've ever had is while making buttons rock side to side.
    The fact that an actor naturally sits with 0 & 360 at the top (pointing up) makes it tricky to do the rocking because you are trying to 'rock' between 340ish to lean left and 20ish to lean right.
    Easily solved though by 'pre' rotating the image by 90 so that when you get it into the editor you can then rotate it back again and you are now able to rock between 70ish to lean left and 110ish to lean right.
    I'm still not convinced that an Angle attribute could've helped me avoid having to pre-rotate my images in this situation.
  • JakeMorJakeMor Member, PRO Posts: 136
    it can be very useful in determining if a given angle is greater or less than your current rotation
Sign In or Register to comment.