Changing an attribute in a timer + Rotation check

KozaxKozax London, UKMember Posts: 9

Hello,

I have a two issues with the game I am currently working:

  1. I have an attribute called difficulty. So I have:
    Every Difficulty Seconds => Change another attribute and do a couple of other things.
    The Difficulty attribute changes successfully from another event and it doesn't have any problem.
    The issue is, the event(every Difficulty seconds) doesn't update after the attribute difficulty is changed later on in the game.

  2. An Actor is affected by physics. Is there any way to check when it has rotated 360 degrees?

Thank you

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    1. Timers do not update their frequency after they start running. Google custom interval timer gamesalad and you should find my demo that offers a workaround. If you have any trouble finding it, let me know.
    2. Actors have a self.Rotation attribute. You can store this value in another attribute that you create (use attribute type angle) and then compare it to the current rotation value.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • KozaxKozax London, UKMember Posts: 9

    Thank you for your reply @tatiang

    1. I found your demo and I will give it a go :smile:
    2. I want every 180 degrees to increase the score.
      I created an attribute(ActorAngle). When the game starts I save the actor angle(self.Rotation) to ActorAngle attribute.
      I made it work so If Self.Rotation >= 180 then game.Score +10 but it only works once because later on the rotation is being increased.
      Could you please give me a hint for resetting the attribute but also make it work for the other side (-180) ?
      I know i need to compare it but it confuses me how to save the variable and how to update it

    Thanks

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    I'm not sure about -180 but to reset it, just change self.StartRotation to self.Rotation. That way, when self.Rotation is 0, self.StartRotation is 0 and you compare it to self.Rotation as it changes until it gets to self.StartRotation + 180. When you then reset self.StartRotation to 180, you can then compare self.Rotation again as it changes to see if it is greater than or equal to self.StartRotation + 180.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • SocksSocks London, UK.Member Posts: 12,822
    edited January 2016

    @tatiang said:
    I'm not sure about -180 but to reset it . . .

    %360 and abs are your friends here ! :)

Sign In or Register to comment.