Trying to get two actors(same ones) to collide and produce a new actor of a different type?

valcaviavalcavia Member Posts: 0

I'm making a numbers game where this actor, 2, collides with another 2 and makes a 4. So I wrote a rule saying when an actor 2 collides with another actor 2 to first destroy the actor and then to spawn a 4. This is only destroying one of the 2's and spawning a 4. I don't want a 2 and a 4 though, I'm trying for just a 4. Any advice?

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    You're running into the fact that actors run their rules fractions of a second apart from each other. So while you'd think that having a collide rule in each actor would result in both actors being destroyed, whichever actor appears first in the scene layer is going to be destroyed first. The other actor then won't detect a collision and won't be destroyed.

    How to get around this? Add a short timer.

    When actor collides with actor2... Timer after 0.1 seconds (run to completion checked)... destroy actor

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

Sign In or Register to comment.