actor destroyed but life counter won't go minus 1....what's not correct?

Hi

Scenario: It's a shoot-em up. My ship get's destroyed when im hit by enemy bullet. When destroyed i want to loose a life but it's not working. Here is what i did so far:

1- I created a "lives" attribute with integer and gave it 3 lives.

2- I added a life counter actor with the "replicate" behavior to 3 lives, dragged it in the play screen.

3- I added a rule in my ship actor saying when actor --> receives or collide --> actor of type --> Enemy Bullet

4- I added "Change Attribute" the chose: game.Lives To game.Lives-1

That's it. At that point when my ship gets hit it destroys but won't loose a life.

Please tell me what i'm missing?

Thanks
Dom

Comments

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

    GameSalad behaviors follow a linear path through your list of rules. If you tell an actor to:

    Destroy Actor Change Attribute

    It will destroy itself and then since the actor no longer exists, it won't change the attribute. At least in theory. Sometimes, it does actually work but a much better approach is to destroy the actor LAST:

    Change Attribute Destroy Actor

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

  • AlphaCentoriAlphaCentori Member Posts: 57

    @tatiang said:
    GameSalad behaviors follow a linear path through your list of rules. If you tell an actor to:

    Destroy Actor Change Attribute

    It will destroy itself and then since the actor no longer exists, it won't change the attribute. At least in theory. Sometimes, it does actually work but a much better approach is to destroy the actor LAST:

    Change Attribute Destroy Actor

    Still won't work

  • AlphaCentoriAlphaCentori Member Posts: 57

    i thought this Gamesalad program was intuitive....not at all if your new at this.
    If your already a mathematician or a programmer then you'll know what to do or else you just have to copy what others do and hope you won't have a bright idea because you won't know how to express it.....

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    Learning GS is no different from other things they take time. Watch videos and learn and make demo projects. It can take a year to learn this software well. Which is faster than learning line coding. Nothing worth doing id easy.

  • LumpAppsLumpApps Member Posts: 2,881

    Riding a bicycle is intuitive. Could you ride your first when you got on? Did you blame the bicycle?

  • SocksSocks London, UK.Member Posts: 12,822

    @Alpha Centori said:
    i thought this Gamesalad program was intuitive....

    It is reasonably intuitive, but you still have to learn how to use it.

    @Alpha Centori said:.
    If your already a mathematician or a programmer then you'll know what to do

    Being a mathematician would have no advantage.

    @Alpha Centori said:
    or else you just have to copy what others do and hope you won't have a bright idea because you won't know how to express it.....

    You just need to sit down and learn how to use GameSalad, it might take a few weeks but it's worth the investment.

  • SocksSocks London, UK.Member Posts: 12,822

    @LumpApps said:
    Could you ride your first [bike] when you got on?

    Yes.

    @LumpApps said:
    Did you blame the bicycle?

    Yes (it had three wheels).

  • AlphaCentoriAlphaCentori Member Posts: 57

    Ok i will calm down and try to be patient and give it a shot. I'll read and look at the tutorials. Thanks for calming me down guys. ; )

  • ArmellineArmelline Member, PRO Posts: 5,369

    GameSalad is incredibly unreliable about firing rules/behaviours "in order". I find that it will always run all behaviours within the same rule before actually destroying an actor, however.

    If you want to ensure that one behaviour is run after the rest within a rule, you can put it in a timer set to "after 0 seconds" and that will usually force GameSalad to run that after anything not within that timer.

    And in my opinion it's nothing to do with being a mathematician or programmer. GameSalad, like other systems similar to it, is all about two things:

    1. Being able to think logically.
    2. Understanding the interface and the behaviours it makes available.

    A background in programming, mathematical or philosophical logic or in electronics will definitely help though, as you'll be more used to thinking in the right kind of way.

  • ookami007ookami007 Member Posts: 581

    Can you post a copy of yours project or a screenshot of your rule. Perhaps seeing the order and how you have done it will make something obvious to the 3rd person. Sometimes troubleshooting your own code or proof reading your own book can be difficult.

  • zenoahzenoah Member, PRO Posts: 56

    add a delay to see if that helps..

    Change Attribute

    | Timer - after 0.1 sec

    | Destroy Actor

  • AlphaCentoriAlphaCentori Member Posts: 57

    Finally found how with the help of this video:

    The thing that confused me is that other video which i think is an old video about an older version of Gamesalad that's why is method works no more:

    This video is obsolete.

Sign In or Register to comment.