Create a global integer value, and call it "spawn random actor" or whatever you want to name it.
Then create and actor (box) and place it off screen somewhere.
Create a rule that says : Timer: every 0.5 seconds (change attribute: game.randomactor to random (1,5) ----> You can also randomize the timer too, say every random(0.5,0.7)
Then create another rule that says:
Timer: every 1 second:
When game.random actor = 1
Spawn: (let's call the actor a cat) Cat1 *relative to scene* x- random(20,300) y- random(30,200) (and put in your attributes next to the arrows, you can set random values to the position on screen)
Otherwise:
When game.random actor = 2
Spawn actor: Cat 2 (same thing here, put random values and relative to scene)
And do this with all your actors.
This is one way of doing it, I'm sure there are other ways to do this, but this is the easiest to explain.
Hope this helps!
Also, for future reference ,when asking for help, don't use the word "Help" in the subject line or it will more than likely get lost in the forums. Simply put: Spawning help needed or something.
Thank you butterbean, I really appreciate the help:)
Chris
gyroscopeI am here.Member, Sous Chef, PROPosts: 6,598
Hi Chris, welcome to the Forums + GS.
You're question is one of the old chestnuts on the Forums but no worries, you're not to know!
Basically, you need a Timer set to every 2 seconds for instance. In that, put a Spawn Behavior. Choose the Actor to be spawned, and for the x axis Position, click on the "e" to get to the Expression editor, hold down the second disclosure triangle and select random. Put your minimum x value in place of min, and the maximum value you want in place of max. Click the green tick.
Now make sure that Position Relative to is set to scene.
If this is triggered by a button on-screen, then you maybe want some control by putting the above Timer and Spawn behavior in a Rule: when touch is pressed.
If you want it to happen automatically, then put the above Rules in an actor outside of the play area. If you want more control, make a boolean attribute called SpawnTrig for instance, and set it's default to true (checkbox ticked); put the Timer + Spawn into a Rule: When SpawnTrig is true. This way you can switch it off if you wanted by making SpawnTrig false somewhere else. Hope that helps.
PS Best to put a more descriptive title for your threads in future than simply "Help". I'll change it to Help with random spawning for you.
Edit: Quick off the draw, Butterbean, you beat me to it!
Comments
Then create and actor (box) and place it off screen somewhere.
Create a rule that says : Timer: every 0.5 seconds (change attribute: game.randomactor to random (1,5) ----> You can also randomize the timer too, say every random(0.5,0.7)
Then create another rule that says:
Timer: every 1 second:
When game.random actor = 1
Spawn: (let's call the actor a cat) Cat1
*relative to scene* x- random(20,300) y- random(30,200) (and put in your attributes next to the arrows, you can set random values to the position on screen)
Otherwise:
When game.random actor = 2
Spawn actor: Cat 2 (same thing here, put random values and relative to scene)
And do this with all your actors.
This is one way of doing it, I'm sure there are other ways to do this, but this is the easiest to explain.
Hope this helps!
Also, for future reference ,when asking for help, don't use the word "Help" in the subject line or it will more than likely get lost in the forums. Simply put: Spawning help needed or something.
Chris
You're question is one of the old chestnuts on the Forums but no worries, you're not to know!
Basically, you need a Timer set to every 2 seconds for instance.
In that, put a Spawn Behavior. Choose the Actor to be spawned, and for the x axis Position, click on the "e" to get to the Expression editor, hold down the second disclosure triangle and select random. Put your minimum x value in place of min, and the maximum value you want in place of max. Click the green tick.
Now make sure that Position Relative to is set to scene.
If this is triggered by a button on-screen, then you maybe want some control by putting the above Timer and Spawn behavior in a Rule: when touch is pressed.
If you want it to happen automatically, then put the above Rules in an actor outside of the play area. If you want more control, make a boolean attribute called SpawnTrig for instance, and set it's default to true (checkbox ticked); put the Timer + Spawn into a Rule: When SpawnTrig is true. This way you can switch it off if you wanted by making SpawnTrig false somewhere else. Hope that helps.
PS Best to put a more descriptive title for your threads in future than simply "Help". I'll change it to Help with random spawning for you.
Edit: Quick off the draw, Butterbean, you beat me to it!
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps