Another cool spawn tech!

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

Another cool spawn tech!

Postby Kilinich » Tue Feb 08, 2011 2:33 pm

I've found new interesting way to spawn objects with dynamic properties

I use class object scope operator "->"
in that way all custom properties (like ttl in example) are stored inside box.

example:
Code: Select all
(scene.addBox {pos := [1,1]; size := [1,1]}) -> {
    color = {[1,1,1,sin(sim.time)]};
    ttl := sim.time;
    density = {sim.time > ttl + 3 ? 0 : 2}
}
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Another cool spawn tech!

Postby Rideg » Wed Feb 09, 2011 11:22 pm

Wow, really helpful. Now I can solve my dynamic tracer mystery. Thank you! :thumbup:
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: Another cool spawn tech!

Postby TC42 » Wed Feb 09, 2011 11:37 pm

Brilliant!! Now I can make realistic tracer-clouds if I understand this properly... what does "ttl := sim.time;" mean?
Image
Spambot wrote:Nowadays, memes usually are studied less in the field of biology, but more with the arena of psychology along with sociology. But, the major area of a meme, getting embraced and imitated all the time is what’s at any core connected with any meme.
User avatar
TC42
 
Posts: 984
Joined: Sun Jan 09, 2011 1:53 pm
Location: $ sudo apt get-install sandwich_

Re: Another cool spawn tech!

Postby electronicboy » Thu Feb 10, 2011 12:02 am

ttl is a custom object variable ;)
and if you don't know, when ever ttl is read, it will give the value that is stored in sim.time (or whatever ttl equals)
When asking for help, READ THE STICKIES!
electronicboy
 
Posts: 1694
Joined: Mon Aug 31, 2009 6:18 pm

Re: Another cool spawn tech!

Postby Rideg » Thu Feb 10, 2011 10:14 pm

TC42 wrote:...what does "ttl := sim.time;" mean?

it's a time marker. Saves the time in ttl-variable when the collision occured.
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: Another cool spawn tech!

Postby electronicboy » Thu Feb 10, 2011 10:51 pm

or that.... Forgot it had to be in brackets fot the thing i said...
When asking for help, READ THE STICKIES!
electronicboy
 
Posts: 1694
Joined: Mon Aug 31, 2009 6:18 pm


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 5 guests