ANIMATE TO CHANGE IMAGE

digitalzerodigitalzero Member, BASIC Posts: 639

Im going to be very quick with this question.... so i have a coin flip image and i have an animation when the coin bounces. if the coin is heads it will go for that image... if its tails it will do the same thing....

well thats not working... any suggestions? if anything it just goes back to the original image of the animation

Comments

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

    Not so fast! You'll need to post a screenshot of those rules.

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

  • digitalzerodigitalzero Member, BASIC Posts: 639

    SURE THING!

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

    One thing to consider is that when you choose a random value for an attribute and then have rules for possible values, the rules only fire when the value changes. So if your scene.heads or tails is 1 and then 1 and then 1 and then 2, it is going to fire the rule for 1, then do nothing, then do nothing again, and then fire the rule for 2.

    Could that be the problem?

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

  • digitalzerodigitalzero Member, BASIC Posts: 639

    that actually made a little sense to me... lolll.... i dont know how else to do this as far as getting either value while still having an instance of the animation and whatnot

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

    This may help.

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

  • IceboxIcebox Member Posts: 1,485

    You have a rule

    When self.hit <= 2 >>> animate (if its less than or equal to 2)

    Then you have another rule

    When self.hit = 2 >>> change image // but it might also animate since the rule above is true

    So do you want it to animate or change image when self.hit = 2.

    One more thing, when you you have more than one rule that have a similar condition try nesting them, it's better practice,

    The way your doing it

    When self.hit = 2 and scene.heads or tails = 1 // change image tails
    When self.hit = 2 and scene.heads or tails = 2 // change image heads
    When self.hit = 2 change attribute motion.linear.velocity.y to 0

    You ended up with three rules and made it a bit messy, to make your life easier just nest them

    When self.hit == 2
    {
    change attribute motion.linear.velocity.y to 0
    When scene.headsOrTails = 1 image tails otherwise image heads
    }

    It should function the same but for the sake of writing good clean code

Sign In or Register to comment.