Iwant to destroy overlapping actors thatare changing value at random whenever they're the same value

LordTarantorLordTarantor Member, PRO Posts: 890
I have a few instance of actor one touching each other and changing colours at random. If at any time any of the actors change to a color and the one beside it is the same color, I want to be able to destroy those by touching any of them. What kind of rule should I create to make this happen?

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    That's tricky! I have an idea and I'll post a demo if I can get it working.

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

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    This is the only way I could think to set this up.

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

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    I didn't include the ability to touch two actors of the same color, but that's a minor addition.

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

  • LordTarantorLordTarantor Member, PRO Posts: 890
    Thanks a lot tatting but the thing is that spanning actors disrupt the performance so bad that it crashes every time I play it on the iPhone.
    Here is why:
    I have 46 actors in place 8 columns of 6 rows.
    Every actor is changing color every few seconds. I created a rule so when there was a change in color the actor will spawn a bigger square so it would overlap with the adjacent squares. The problem is that that was to much for it. 46 actors each one spawning a square every2 to 5 second...
    So I figure that If I found the way to make the squares already overlapping I wouldn't have to spawn anything.
    I tried making a rule to change their name but I don't know how to make an touching or overlapping rule about it.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited January 2014
    It helps when you can provide more details such as your last post. Otherwise, I'm largely guessing about what you're trying to do.

    Why are you changing their names? You can't affect a collision rule after you've run it once. What you can do, though, is to change an actor's tag. So you might get somewhere with that.

    I changed my demo so that it spawns 20 actors per second and the performance is a little sluggish. With 48 actors, depending on the complexity of their rules, you may have problems with performance.

    I can't think of another way to do this but someone else may have a clever technique.

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

  • LordTarantorLordTarantor Member, PRO Posts: 890
    Thanks a lot for trying I'll check the tag changing technique.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Thanks a lot for trying I'll check the tag changing technique.
    I haven't been able to get it to work in limited testing but it was a thought!

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

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Then again, this seems like progress:

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

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    And lastly, here's a version where you have to click/tap to destroy identical colors that are overlapping. It doesn't work perfectly...

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

  • LordTarantorLordTarantor Member, PRO Posts: 890
    Wow tatiang!!! that was genius!!!
    Thanks a lot
    Do you know what would I have to add so if I touch one blue and let say that blue is touching 3 more blues the all 4 are destroyed?
Sign In or Register to comment.