destroy multiple actors.

GnarlyGnarly canadaMember Posts: 840

Still learning game salad.

I can make a rule to when an actor is touched it will be destroyed. How do you program when an actor is touched multiple actors are destroyed???

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited June 2014

    Hello @gattoman Make a boolean, let's call it Destroyed

    In each and every actor you want to be destroyed at the same time, add the Rule:

    When Attribute Destroyed is true
    Destroy
    

    And when you want this to happen, say with a button, put it into its rules:

    When touch is pressed
    Change Attribute Destroyed to true
    

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • GnarlyGnarly canadaMember Posts: 840

    Thank you. I understand basic. programming. It would be easier for me to do this in code. I am trying to learn how to "code" in gamesalad.

    I will try this out.

    Very helpful.
    Thanks!!

  • GnarlyGnarly canadaMember Posts: 840
    edited June 2014

    @gyroscope said:
    Hello gattoman Make a boolean, let's call it Destroyed

    In each and every actor you want to be destroyed at the same time, add the Rule:

    When Attribute Destroyed is true
    Destroy
    

    And when you want this to happen, say with a button, put it into its rules:

    When touch is pressed
    Change Attribute Destroyed to true
    

    I tried and worked great. Thanks

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited June 2014

    You're welcome. :smile:

    @gattoman said:

    I am trying to learn how to "code" in gamesalad.

    And for the record, as one of GameSalad's selling points is "Create Games Rapidly
    Drag & Drop, No Code" the majority of users call putting together the ready-made lumps of code as programming. (Despite GS telling us there isn't any coding to do, a few users still call it coding - bit illogical on their part, I always think...) :wink:

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • virk0009virk0009 Member Posts: 4

    This logic of taking a Boolean seems very lame to me. If there are 20 instance of an object and they share same variable to die, but you want to only 3 to die, how is it going to work? It will kill all 20.

  • bob loblawbob loblaw Member, PRO Posts: 793

    allocate a cell in a table to each of the 20 instances (which effectively makes it work like an array). if the cell value corresponding to the actor meets a condition, destroy it.

  • adent42adent42 Key Master, Head Chef, Executive Chef, Member, PRO Posts: 3,054

    When selling it, I try to differentiate "code" from "programming". You're programming and to an extent you're coding (expressions are really lua expressions with some special sauce for referencing our attribute system). But it's not "coding" in the traditional textual syntax sense.

Sign In or Register to comment.