Collision

bradenpowellbradenpowell Member Posts: 16
edited November -1 in Working with GS (Mac)
I want to make a rule where if one color of object is touching the same color of object and you click one of them they will both be removed. Any ideas?

Comments

  • zombieaddictzombieaddict Member Posts: 213
    make 2 seperate integer attributes for each colour you want. lets use blue as an example.

    BlueContact
    KillBlue

    Have both of those set to 0

    Inside the blue actor have
    .
    .
    Rule when actor overlaps/collides with actor Blue
    .
    change attribute game.BlueContact to 1
    .
    .
    .
    Now have a seperate rule
    .
    When actor receives touch is pressed and game.BlueContact = 1
    .
    change attribute game.Killblue to 1

    and last rule When attribute game.KillBlue = 1
    .
    Destroy behaviour

    just do that for all your coloured objects
  • bradenpowellbradenpowell Member Posts: 16
    When you say destroy behavior do you mean destroy the actor? Because I wan't to be able to click on one of them but if 2 of them are touching it will delete both the actors with one click.
  • zombieaddictzombieaddict Member Posts: 213
    yeah destroy behaviour. the code above will only destroy them if the same colour object is touching. if it isnt, then they won't destroy
  • bradenpowellbradenpowell Member Posts: 16
    With one click (touch)?
  • zombieaddictzombieaddict Member Posts: 213
    yip.. ive tested it.
  • bradenpowellbradenpowell Member Posts: 16
    Cool. Thanks.
  • bradenpowellbradenpowell Member Posts: 16
    I just tried it everything is working, except the part where if two of the same colors are touching it won't destroy both with one click. Any ideas?
  • zombieaddictzombieaddict Member Posts: 213
    check that the trigger for the Contact attribute is setup properly. are you using boolean or integers? i can have a look at the project if you want me to.
Sign In or Register to comment.