GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

making individual life "hearts" blink

I am attempting to a little bit of animation to the health "hearts" bar. Currently the is one heart replicated to 5 times, attached to a "life" integar. When the value changes - the num of hearts is adjusted accordingly.

Is it possible to control each replicated instance individually? I.e. making fade out, pop, etc. ?

Comments

  • Braydon_SFXBraydon_SFX Posts: 8,966Member, Sous Chef, PRO, Bowlboy Sidekick GameSalad Employee

    Unfortunately, no. You'd have to manually drag and place your heart actors on screen to edit their properties. You cannot call or adjust the properties of the replicated actors.

  • shylevarishylevari Posts: 16Member

    Ok thanks. So basically create 5 different actors and attach each one a behavior checking the value of "life"

    Unless maybe there's a way to create a "for" loop in gamesalad? To run one behavior on all the hearts?

  • tatiangtatiang Posts: 11,833Member, Sous Chef, PRO, Senior Sous-Chef
    edited December 2014

    You can give the heart actor an integer attribute called self.myPosition. Then in the scene, double-click each heart actor and change its self.myPosition value to match it's position (e.g. the first in line is 1, the second is 2, etc.). Set up the rule this way:

    If self.myPosition ≤ game.life
    Change attribute self.color.Alpha to 1
    Else
    Change attribute self.color.Alpha to 0

    Edit: that won't make them blink but will instead just make them visible. In the 'If' portion of the rule, just add your blink timer there.

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

  • Yes! you could do 1. if health = # change image/animate

    = whatever you want you number to be.

Sign In or Register to comment.