Increase size of a spawned tracer + making it fade away

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

Increase size of a spawned tracer + making it fade away

Postby Rideg » Sun Dec 26, 2010 6:25 pm

Hello. I'm making a bomb were I need to spawn a tracer on a small ball and after that keep the tracer increasing and dading at the same time to give it a shockwave effect. I've tried to reengineer Davidz Howitzer but unsuccessful. I didn't understand how tha code worked and I hate borrowing other scene's codes. Hope You can help me
-Johan
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: Increase size of a spawned tracer + making it fade away

Postby Kilinich » Sun Dec 26, 2010 8:54 pm

Rideg wrote:Hello. I'm making a bomb were I need to spawn a tracer on a small ball and after that keep the tracer increasing and dading at the same time to give it a shockwave effect. I've tried to reengineer Davidz Howitzer but unsuccessful. I didn't understand how tha code worked and I hate borrowing other scene's codes. Hope You can help me
-Johan


Code: Select all
Scene.my.addSmoke := (sPos, sSize, sColor, sTime)=>{geval("scene.addCircle({pos := " + sPos + "; radius := .1; color := [0,0,0,0]; drawCake := false; collideSet := 0; drawBorder := false; density := {sim.time > " + sim.time + "+" + sTime + " ? 0 : 0.005}}); scene.addPen({pos := " + sPos + "; fadeTime := 0; color := {" + sColor + " - [0,0,0," + sColor(3) + "*(sim.time - " + sim.time + ")/" + sTime + "]} ; size := {0.01+" + sSize + " * (sim.time - " + sim.time + ")/" + sTime + "}}) ")};
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: Increase size of a spawned tracer + making it fade away

Postby Rideg » Mon Dec 27, 2010 3:04 pm

I couldn't get it to work. Could you write me a tutorial? :)
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: Increase size of a spawned tracer + making it fade away

Postby Kilinich » Mon Dec 27, 2010 3:56 pm

Rideg wrote:I couldn't get it to work. Could you write me a tutorial? :)


1. Get last Algodoo.
2. copy code
3. paste code in console and press enter
4. call scene.my.addSmoke(position, max_size, color, fade_time) from your script or console.
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: Increase size of a spawned tracer + making it fade away

Postby Rideg » Mon Dec 27, 2010 9:09 pm

Is it possible to make it without any scene.my.* variables :angel:
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: Increase size of a spawned tracer + making it fade away

Postby Kilinich » Mon Dec 27, 2010 9:43 pm

Rideg wrote:Is it possible to make it without any scene.my.* variables :angel:

Sure, just pick my code, replace variables and insert in your events.
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: Increase size of a spawned tracer + making it fade away

Postby Rideg » Mon Dec 27, 2010 10:53 pm

Okay great. Thank you very much :)
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 10 guests