Spawing 2 actors at the same time

gastounet73gastounet73 Member, PRO Posts: 11
edited May 2014 in Working with GS (Mac)

Hi.
I'm working on a game. I have a spaceship to control and avoid colision with the other actor.
I have a table with the rules to spawn an actor (1stSpawnY, 1stspawnX, 2ndspawnY, 2ndSpawnX,....)

Atribute iDistance traveled : iDistance (update every 0.05 sec)
Atribute NextSpawn =1

On the top of the screen i have an actor with the folowing rule:

"If (iDistance>tablecell(mytable,1,nextspawn))
-Spawn Actor Y=0 X=tablecell(mytable,1,nextspawn+1)
-Nextspawn=nextspawn+2"

This is all working good but if they are 2 spawn at the same time, just the first one is spawing and then no more spawn...
I think i should have a very small timing delay on the 2nd spawn but he normally should spawn.

I check and the "if" condition is true but nothing happens.

Whats do i have to do?

Comments

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

    Post a screenshot of your rules. I'm finding it really hard to decipher this:

    "If (iDistance>tablecell(mytable,1,nextspawn))
    -Spawn Actor Y=0 X=tablecell(mytable,1,nextspawn+1)
    -Nextspawn=nextspawn+2"

    Are you using Windows Creator? Mac Creator has "When" rules and you posted in the Mac subforum so I'm just curious.

    To spawn multiple actors, use multiple spawn behaviors. But maybe there's more to your algorithm than that and I'll know once I see your screenshot(s).

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

  • gastounet73gastounet73 Member, PRO Posts: 11
    edited May 2014

    I'm on Mac

    This is working properly exept when 2 asteroide has to spawn at the same time

  • gastounet73gastounet73 Member, PRO Posts: 11
    edited May 2014

    I just found a solution (screenshot bellow). I don't like it but it's working. I'll really appreciate if someone explain me why the first one didn't worked. It never do a if condition 2 times in a row.

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

    I'm still unclear about how your game is setup (which actor is spawning the Ast1 actor, for example) but I'll offer this in case it's helpful: a rule will only trigger if the "state" of the rule changes from false to true. As an example, if you have a rule that says When attribute game.score > 100 spawn an actor, it will trigger when the score goes from 0 to 150 but it will not trigger again when the score goes from 150 to 300 because the rule was already true at 150.

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

Sign In or Register to comment.