Delay?
10 posts • Page 1 of 1
Delay?
I'm trying to make a scene where I use a laser to change the attraction of an object, then change back when it hits again. But when the laser hits it it runs the script every step. How do I put in a 1 or 2 second delay?
Here's my script I'm using:
Here's my script I'm using:
- Code: Select all
(e)=>{attraction = -10000 - attraction}
-
Sonic - Posts: 1467
- Joined: Tue Sep 01, 2009 6:18 pm
- Location: America!!!
Re: Delay?
(e)=>{sim.time > controllerAcc ? {controllerAcc = sim.time+10; {do something}} : {} }
and don't forget to reset controlleAcc to zero.
and don't forget to reset controlleAcc to zero.
Dream of Algodoo as game development engine...
-
Kilinich - [Best bug reporter 2010]
- Posts: 2098
- Joined: Mon Aug 31, 2009 8:27 pm
- Location: South Russia
Re: Delay?
- Code: Select all
(e)=>{(e.geom.controllerAcc - sim.time) >= 2 ? {attraction = -10000 - attraction; e.geom.controllerAcc = sim.time}:{}}
This is pretty much the same I think it's a little easier to see how it works.
make sure to check out my work.
-
Rideg - Posts: 948
- Joined: Tue Dec 15, 2009 5:17 pm
- Location: Östersund, Sweden
Re: Delay?
wait what is e.geom.controllerAcc ???
BTC: 12wcLxBejr6rhCk6WPyVSNmkjwwbxXEvBG
LTC: LQ17UdL71xzLCprSfkoWUQXDXWuHjx2nf9
FTC: 6nfbPuFbtk8uNokYSsVfbzc5393ggxNGDC
polygons > textures
STUFFES:
http://www.algodoo.com/algobox/profile.php?id=4540
LTC: LQ17UdL71xzLCprSfkoWUQXDXWuHjx2nf9
FTC: 6nfbPuFbtk8uNokYSsVfbzc5393ggxNGDC
polygons > textures
STUFFES:
http://www.algodoo.com/algobox/profile.php?id=4540
-
sheepborg - Posts: 203
- Joined: Sat Dec 05, 2009 10:44 pm
- Location: North Carolina USA
Re: Delay?
I'm sure your aware of the geometry controllers(that thing that can make you move objects with the arrow keys). It's a property of any geometry. It's been commonly used now to store properties in an object and such.
Millions of voices suddenly cried out in terror, and were suddenly silenced. Something terrible has happened.
-
RicH - [Funniest Person 2010]
- Posts: 2043
- Joined: Tue Sep 01, 2009 9:01 am
Re: Delay?
it can be anything you wont have any need of. Just a "storage for numbers" you could also use a variable
- Code: Select all
(e)=>{(scene.my.anything - sim.time) >= 2 ? {attraction = -10000 - attraction; scene.my.anything = sim.time}:{}}
make sure to check out my work.
-
Rideg - Posts: 948
- Joined: Tue Dec 15, 2009 5:17 pm
- Location: Östersund, Sweden
Re: Delay?
Whatever guys. It didn't work anyway, so I used a key bind.
-
Sonic - Posts: 1467
- Joined: Tue Sep 01, 2009 6:18 pm
- Location: America!!!
Re: Delay?
keybinds do leak to config files, so its not a very good idea.
Jrv wrote:TC42 wrote:Quite honestly, I didn't think anyone on 4chan has that good a use of grammar, spelling, usage, mechanics, ect.
But I've never been there, so I may be wrong.
GTFO newfgt
-
RA2lover - Posts: 607
- Joined: Mon Aug 31, 2009 8:43 pm
- Location: Brazil
Re: Delay?
It's localized. It just affects an object in the scene, nothing more.
-
Sonic - Posts: 1467
- Joined: Tue Sep 01, 2009 6:18 pm
- Location: America!!!
10 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 14 guests