Newbie needs help with spawning.

My apology on asking this question since it seems like it get asked quite a bit, it's just that I can't get this to work.

So I'm currently trying to make a tiny little game and been able to figure things out on a trial and error basis. Anyways the trouble is getting one of two actors to randomly spawn after death.

When the scene starts there is one actor and you can increase the size of this actor by clicking a button but once this actor gets to a certain size (200 at the moment.) they die (Like a balloon being popped with too much air.) My goal is to have one of these two actors randomly spawn once the first actor dies.

How can I randomly have one of these two actors spawn after death over and over again?

Again my apology if this is coming across confusing or has been asked quite bit.

Comments

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

    When self.Size.Width ≥ 200
         Change Attribute self.randomNum to 0
         Change Attribute self.randomNum to random(1,2)
         When attribute self.randomNum = 1
              Spawn Actor [actor 1]
         When attribute self.randomNum = 2
              Spawn Actor [actor 2]

    The first change attribute behavior is necessary to prevent an issue that occurs when you choose a random value and the condition of the rule doesn't change (e.g. if self.randomNum = 1 and then self.randomNum = 1 again, the top rule won't trigger).

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

  • LukeTheRabbitThiefLukeTheRabbitThief Member Posts: 3

    Thank you Tatiang! That was exactly the issue, I didn't change the attribute back to 0. Awesome.

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

    You're welcome!

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

Sign In or Register to comment.