How to change density of spawned objects with onKey?

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

How to change density of spawned objects with onKey?

Postby pnvv » Fri Sep 12, 2014 10:58 pm

I built this spawn engine and I want to figure out some sort of throttle mechanism for it. I know changing the density of the spawned geoms will affect engine speed, but I'm not sure how to do that without using lasers, and having to haul around a bunch of lasers is kind of impractical. I also need someone to help me figure out how to change the spawned particles back to their original density when I let off the throttle.
Image

(/)(°,,,°)(/)
User avatar
pnvv
 
Posts: 670
Joined: Tue Aug 26, 2014 11:46 pm
Location: Disunited States of America

Re: How to change density of spawned objects with onKey?

Postby electronicboy » Fri Sep 12, 2014 11:31 pm

Easiest method which I can describe is essentially a flipper switch, 3 rectangles laid vertically, edge ones fixated, the centre one should have a hinge at the base. Set the hinge to motor, and set the reverse key as your acceleration key, and add the thyme you wish to use on the relevant outer boxes.
When asking for help, READ THE STICKIES!
electronicboy
 
Posts: 1694
Joined: Mon Aug 31, 2009 6:18 pm

Re: How to change density of spawned objects with onKey?

Postby pnvv » Fri Sep 12, 2014 11:59 pm

electronicboy wrote:Easiest method which I can describe is essentially a flipper switch, 3 rectangles laid vertically, edge ones fixated, the centre one should have a hinge at the base. Set the hinge to motor, and set the reverse key as your acceleration key, and add the thyme you wish to use on the relevant outer boxes.


What I mean is directly changing the properties of the spawned particles without any oncollide involved.

I also found that the thing stays at full throttle even after stop pressing the button. How do I fix this? Basically what I mean is how to change the density back after the button is released...
Image

(/)(°,,,°)(/)
User avatar
pnvv
 
Posts: 670
Joined: Tue Aug 26, 2014 11:46 pm
Location: Disunited States of America

Re: How to change density of spawned objects with onKey?

Postby Kilinich » Sat Sep 13, 2014 10:19 am

Please read this http://www.algodoo.com/forum/viewtopic.php?f=13&t=10580&start=0
You could write script to change some variable on key press and back to default value on release.
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: How to change density of spawned objects with onKey?

Postby pnvv » Sat Sep 13, 2014 3:05 pm

Kilinich wrote:Please read this http://www.algodoo.com/forum/viewtopic.php?f=13&t=10580&start=0
You could write script to change some variable on key press and back to default value on release.

Thank you, that helped very much.
Image

(/)(°,,,°)(/)
User avatar
pnvv
 
Posts: 670
Joined: Tue Aug 26, 2014 11:46 pm
Location: Disunited States of America


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 7 guests