FOR rule.

I want to play an animation for every single score increment. How do i do this?

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited April 2015

    How are you incrementing your score ?

  • benjaminmagebenjaminmage Member Posts: 74

    @Socks Like this.

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

    When actor collides with actor of type Bird
         Change Attribute game.score to game.score+1
         Change Attribute game.Animate to true

    Then in the animation actor:

    When attribute game.Animate is true
         Animate
         After 1 second (duration of animation)
              Change game.Animate to false

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

  • benjaminmagebenjaminmage Member Posts: 74

    @tatiang its working but apparently, it only plays the animation once and thats it..

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

    Your rule is:

    If attribute game.Animate is true
         Animate

    What I wrote was [somehow "Timer" didn't make it in my first post]:

    If attribute game.Animate is true
         Animate
         Timer After 1 second (duration of animation)
              Change game.Animate to false

    *For future reference, if you place a behavior outside of a rule, it triggers instantly assuming there are no other "loose" behaviors above it. So your Change Attribute game.Animate Score to false would actually trigger as soon as the scene loads. It needs to be inside of a timer that is inside of the rule.

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

Sign In or Register to comment.