What is the thyme code to make a lazer change colour?

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

What is the thyme code to make a lazer change colour?

Postby tlp » Sat Sep 05, 2009 9:14 pm

At random.
Thanks
tlp
 
Posts: 13
Joined: Mon Aug 31, 2009 10:55 pm

Re: What is the thyme code to make a lazer change colour?

Postby RA2lover » Sun Sep 06, 2009 2:15 am

actually, for now, its impossible, as laser variables dont save with scene.
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
User avatar
RA2lover
 
Posts: 607
Joined: Mon Aug 31, 2009 8:43 pm
Location: Brazil

Re: What is the thyme code to make a lazer change colour?

Postby Torpedo » Sun Sep 06, 2009 1:25 pm

Not always but sometimes do. My TV scene the maxrays function is set by a variable.

one way you can do what you are asking for is when an object is hit by a laser,

(e)=>{e.laser.color = [1,1,1,1]}

which would make it white, or any other value you can enter in there would give other colours. just gave white as an example. An advantage of this is as it will go into the objects "onHitByLaser" (i think thats the name, you'll know when you see it) it shouldnt disapear.

or using vairiables, bring down the debug screen by pressing "¬"

when you've done that make a vairiable up, say here

scene.my.var1 = [1,1,1,1]

then click your laser, click script, and in the color box type in

{scene.my.var1}

and that should make the laser change colour to whatever scene.my.var1's array is set to. MAKE SURE the array is in that format and the numbers do not exceed 1 or you may lose the variable entry.

an advantage to this is you can set scene.my.var1 in an oncollide or on laserhit elsewhere in the scene and change the color of your laser that way, by say making a random box somewhere else have an oncollide of

(e)=>{scene.my.var1 = [1,0,0,1]

which if i remember right is the colour for red.

I hope this helps you!
Image
User avatar
Torpedo
 
Posts: 120
Joined: Mon Aug 31, 2009 8:51 pm


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 1 guest