slow spawn

About advanced scenes, and the Thyme scripting language used in Algodoo.

slow spawn

Postby mrmegawarrior » Fri Dec 24, 2010 3:04 am

i am trying to spawn objects but when i do it the object spawns very fast and it makes too many of them. how do i force objects to spawn at a slower rate
mrmegawarrior
 
Posts: 80
Joined: Wed Aug 25, 2010 6:25 am

Re: slow spawn

Postby Mystery » Fri Dec 24, 2010 5:03 am

This is more about the mechanics then the thyme.
If you're using a laser make the object spawn in the path of the laser to temporarily block it. Or you could use a spinning square and use oncollide so you can fine tune the frequency of collisions.
User avatar
Mystery
 
Posts: 2802
Joined: Thu Sep 03, 2009 1:16 pm
Location: Southern Australia

Re: slow spawn

Postby mrmegawarrior » Fri Dec 24, 2010 5:48 am

so there is no way to do it with thyme?
mrmegawarrior
 
Posts: 80
Joined: Wed Aug 25, 2010 6:25 am

Re: slow spawn

Postby Mystery » Fri Dec 24, 2010 9:29 am

No way that is worth doing.
You could get craft with some timers
viewforum.php?f=13
Look at section 9 and 13.
User avatar
Mystery
 
Posts: 2802
Joined: Thu Sep 03, 2009 1:16 pm
Location: Southern Australia

Re: slow spawn

Postby Rideg » Fri Dec 24, 2010 1:43 pm

I use this:
Code: Select all
(e)=>{sim.time - e.this.controllerAcc >= 1 ? {scene.addCircle({}); e.this.controllerAcc = sim.time}:{}}

IMPORTANTset it's controlller accelerator to zero and it should spawn a circle every second
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden

Re: slow spawn

Postby davidz40 » Fri Dec 24, 2010 3:44 pm

Or use something like:

Code: Select all
controllerAcc=controllerAcc+1; controllerAcc>100 ? {Spawn code here; controllerAcc=0}:{};
Phundamentalist
User avatar
davidz40
 
Posts: 438
Joined: Sun Sep 06, 2009 10:30 am

Re: slow spawn

Postby mrmegawarrior » Fri Dec 24, 2010 9:24 pm

thanks they worked
mrmegawarrior
 
Posts: 80
Joined: Wed Aug 25, 2010 6:25 am

Re: slow spawn

Postby InfinityPlayer » Tue Jan 25, 2011 7:40 pm

davidz40 wrote:Or use something like:

Code: Select all
controllerAcc=controllerAcc+1; controllerAcc>100 ? {Spawn code here; controllerAcc=0}:{};


I guess you put this code on the onCollide part of the objects scripting menu :?:
I am still learning, not an expert yet. I'm just here to have some phun.
InfinityPlayer
 
Posts: 40
Joined: Thu Dec 09, 2010 7:57 pm

Re: slow spawn

Postby davidz40 » Wed Jan 26, 2011 3:14 pm

Oncollide or onlaserhit, depends what you use to activate spawer.
Phundamentalist
User avatar
davidz40
 
Posts: 438
Joined: Sun Sep 06, 2009 10:30 am


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 5 guests