How to Kill one bird with one stone

amigoniamigoni Member Posts: 78
edited November -1 in Working with GS (Mac)
Need help with this. I have a rule that if I touch an actor inside. It dies. But if two actors overlap they both die. How can I make it so that only one of them dies?

Even better. How can I check that one actor doesn't overlap too close to another one. Right now my actors sometimes re-spawn at exactly the same location. So I can't tell how many there are. I do have a random generator going but if they are killed at the same time they get the same variables to be re-spawned to.

Thanks

Leo

Comments

  • iPhoneDevForMeiPhoneDevForMe Member Posts: 362
    Just off the top of my head, try this:

    Create a boolean actor variable and call it "Touched"

    Then add a rule:
    When actor receives event touch is pressed
    --Change attribute self.touched to true

    When attribute self.touched is true
    --Destroy actor

    I donno if this will actually help or not cuz im not at home to test out, but its worth a shot

    -Kyle
  • amigoniamigoni Member Posts: 78
    I will try that. But my suspicion is that both are getting touched so both of them will have the bolean value change.

    Just as a note. It is better to use an integer as a switch since as you touch the variable will keep switching between true and false with the bolean.
  • StusAppsStusApps Member, PRO Posts: 1,352
    You could constrain a smaller actor to the bigger one. If that actor has a rule to change a boolean to true when touched you could use that to destroy the bigger actor.

    Take the touch away from the big one and you now have a touch area smaller than the actual actor. Obviously this will use more resources, but ok if you don't have too many actors.
Sign In or Register to comment.