two collides for destroy actor?

RUPASRUPAS Member Posts: 823
edited November -1 in Working with GS (Mac)
hello friends, I have an actor who changes the picture when it collides, as I can do to make the second collision is destroyed

Comments

  • PhoticsPhotics Member Posts: 4,172
    If actor overlaps with actor of type X
    --If self.counter = < 2
    --Then change self.counter to self.counter+1
    --Else destroy

    You might want to create the physics manually, to prevent the collisions overwriting your rules.
  • quantumsheepquantumsheep Member Posts: 8,188
    Change the value of counter to 2 maybe? Currently it's set to 0, which I imagine will destroy it...

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • RUPASRUPAS Member Posts: 823
    does not work, what I want is;

    First collision - change of image
    second collision-destroy
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    make a attribute call it hitcount

    Have a rule in the actor when it overlaps with the other actor change attribute hitcount to hitcount+1

    Make another rule when attribute hitcount=1
    then put a change image behavior in there

    then make another rule when attribute hitcount=2
    then put destroy actor in there
  • RUPASRUPAS Member Posts: 823
    JohnPapiomitis said:
    make a attribute call it hitcount

    Have a rule in the actor when it overlaps with the other actor change attribute hitcount to hitcount+1

    Make another rule when attribute hitcount=1
    then put a change image behavior in there

    YES!!! very thanks

    then make another rule when attribute hitcount=2
    then put destroy actor in there

  • RUPASRUPAS Member Posts: 823
    nooo!!! hahaha one more problem, if you get 3 items, break the 3 at the same time not one by one.
  • RUPASRUPAS Member Posts: 823
    can someone help? I will explain better what I JohnPapiomitis friend says it works great but there is an error, if I put 3 objects and the ball collides with a single, break the 3 at the same time.
  • LordTarantorLordTarantor Member, PRO Posts: 890
    Rupa lo que está sucediendo es que estás usando un atributo global que obviamente afecta a todas.
    Olvídate de este atributo y utiliza el que pusiste dentro del actor. Lo llamaste counter. En lugar de ser 0 ponle un 2. En este actor vas a poner una regla que diga:
    Rule
    When overlaps or collide con greenball
    (change attribute)
    change attribute self counter to self counter -1

    Entonces vas a poner otra regla que diga:
    when attribute self counter = 1
    change image a la rota

    luego vas a poner otra regla que diga:
    when attribute self counter < o igual que 0
    change self position X to -60

    Verifica a ver como te funciona.
  • RUPASRUPAS Member Posts: 823
    LordTarantor said:
    Rupa lo que está sucediendo es que estás usando un atributo global que obviamente afecta a todas.
    Olvídate de este atributo y utiliza el que pusiste dentro del actor. Lo llamaste counter. En lugar de ser 0 ponle un 2. En este actor vas a poner una regla que diga:
    Rule
    When overlaps or collide con greenball
    (change attribute)
    change attribute self counter to self counter -1

    Entonces vas a poner otra regla que diga:
    when attribute self counter = 1
    change image a la rota

    luego vas a poner otra regla que diga:
    when attribute self counter < o igual que 0
    change self position X to -60

    Verifica a ver como te funciona.

    lord aqui hace falta mas gente como tu eres grande, funciona perfecto maestro
Sign In or Register to comment.