can self rotation be changed in game with gs 0.91?

as7494as7494 Member Posts: 70
edited November -1 in Working with GS (Mac)
I am wondering if anyone has gotten self-rotation to change in game using an attribute rule. since I have tried for a very long time and havent been able to change this setting.

Comments

  • old_kipperold_kipper Member Posts: 1,420
    Yes. In my case I did the below to switch the actor around based on screen orientation.

    add a game attribute in the scene inspector/game/attributes

    in mine I added a integer (number) attribute and called it 'clock rotor' by default this is set at 0 and is fine...

    then I added a background actor and and in the actor editor added a timer to it from basic behaviours

    this is set to 'every 0 seconds'

    Inside the timer I added 4 rules to send numbers to my game attribute 'clock rotor'

    these were rule all/attribute/game.screen.device orientation/is/landscape left

    then

    change attribute game/clock rotor to 1

    I then made 3 more rules for each direction, each changing the number stored in my 'clock rotor attribute by 1

    to check this I added a display text to my background and set it to game.clock rotor

    this made sure things were running correctly before applying the rule to an actor.

    Then I created the actor I actually wanted to rotate and in his actor editor page added for rules to change his rotation-

    Up rule- When all attribute/game.clock rotor=1

    change attribute to self.rotation to 0

    down rule- When all attribute/game.clock rotor=2

    change attribute to self.rotation to 180

    left rule- When all attribute/game.clock rotor=3

    change attribute to self.rotation to 270

    right rule- When all attribute/game.clock rotor=4

    change attribute to self.rotation to 90

    hope that helps
  • as7494as7494 Member Posts: 70
    thanks a lot ill try it out
Sign In or Register to comment.