How can I put min and max into a rotate behavior?

crazycam99crazycam99 Paris, FranceMember Posts: 519
edited August 2012 in Working with GS (Mac)
Hello Guys,

How can I put min and max into a rotate behavior for that you can go from 315° to 45°?

Thanks

Best Answer

  • gyroscopegyroscope I am here.Posts: 6,598
    edited August 2012 Accepted Answer
    OK, I see how you want to apply this now.

    I've been thinking your problem through and although I haven't done a test to check it out, I'm almost certain the following solution will work out as you want.

    First to say, your tabs (I think you call them platforms)- lets talk about the left one first, pointing to 9 o'clock. It'd make things much less complicated if this graphic was remade with the tab pointing at 3 o'clock (i.e 0º) in Illustrator/Photoshop whatever it was.

    Then when it's brought into GSC, rotate the actor using its Rotation attribute to 180º.

    Now in this actor's Rules, amend what you have as follows, after making another attribute (Angle), lets call it Angle1:

    When actor receives event key Z is down
    Constrain Attribute game.Angle1 To self.Rotation

    --- nested in above rule:
    When attribute game.Angle1 > 124
    Rotate
    Clockwise speed 100

    When actor receives event key A is down
    Constrain Attribute game.Angle1 To self.Rotation

    --- nested in above rule:
    When attribute game.Angle1 < 226
    Rotate
    Counter-Clockwise speed 100

    -------

    Now for the other side, duplicate this actor (still rotated to 180º) and flip the image horizontally; this will be for the right side. Make another Angle attribute, called Angle2.

    Amend its Rules as follows:

    When actor receives event key ? is down
    Constrain Attribute game.Angle2 To self.Rotation

    --- nested in above rule:
    When attribute game.Angle2 >314
    Rotate
    Clockwise speed 100

    When actor receives event key ? is down
    Constrain Attribute game.Angle2 To self.Rotation

    --- nested in above rule:
    When attribute game.Angle2 < 46
    Rotate
    Counter-Clockwise speed 100

    Hope that works out for you.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Answers

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    @crazycam99

    Hi, would this work for you: change your actor's Rotation attribute to 315º then use a Rotate to Angle Behaviour with Angle set to 45º.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • crazycam99crazycam99 Paris, FranceMember Posts: 519
    @gyroscope

    No I didn't mean that. I meant:
    How can I make it for that an actor can only rotate from 350° to 45° passing by 0° and can't rotate to any angle smaller than 350° and bigger than 45°
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598

    If you make your actor move from 350º to 45º it won't be rotating any smaller than 350º or bigger than 45º anyway....

    And if you actor starts off at 350º and you use the Rotate to Angle Behaviour to make it move to 45º anti-clockwise it moves through 0º degrees. So not sure what your after now.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited August 2012

    Why did you reject both my answers? I'm interested to know.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • crazycam99crazycam99 Paris, FranceMember Posts: 519
    edited August 2012
    @gyroscope

    I want it when you click on a button it turns clockwise and can't go bigger than 350° and when you click on another button it turns counter clockwise and can't get smaller than 45°
  • crazycam99crazycam99 Paris, FranceMember Posts: 519
    Uploading youtube video to show you
  • crazycam99crazycam99 Paris, FranceMember Posts: 519
    @gyroscope

    here is a youtube video to show you

  • crazycam99crazycam99 Paris, FranceMember Posts: 519
    edited August 2012
    Thanks @gyroscope

    I even found a way to optimize the rules using your base.


    Thanks
Sign In or Register to comment.