script help

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

script help

Postby FLO » Fri May 12, 2017 7:24 pm

is it possible that if the simulation is stopped that this color has the object [1.0, 1.0, 1.0, 1.0] then for example and when the simulation will run the object that has this color [0.0, 0.0, 0.0, 1.0].
I make mainly games.
best games
best game engine
User avatar
FLO
 
Posts: 16
Joined: Thu Aug 18, 2016 5:11 pm
Location: germany

Re: script help

Postby Kilinich » Wed May 17, 2017 1:17 am

1) color == [1,1,1,1] ? {sim.running = false} : {}
2) color == [0,0,0,1] ? {sim.running = true} : {}
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: script help

Postby FLO » Wed May 17, 2017 4:06 pm

Many thanks to the always helping me, I find it greatly appreciate it.

I think I put it a little wrong, this should happen actually exactly the other way around.
I make mainly games.
best games
best game engine
User avatar
FLO
 
Posts: 16
Joined: Thu Aug 18, 2016 5:11 pm
Location: germany

Re: script help

Postby Xray » Fri Jun 09, 2017 6:12 am

The following line of code must be placed in update (it will not work in postStep).

sim.running ? {color = [0,0,0,1]}:{color = [1,1,1,1]}

What this does:
When the simulation is running, the color will be black.
When the simulation is not running, the color will be white.


Is that what you want?
User avatar
Xray
 
Posts: 500
Joined: Sun Jun 17, 2012 6:12 am
Location: USA


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 15 guests