color change help

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

color change help

Postby HavingPhun » Sun Apr 03, 2011 2:32 pm

I am getting better at thyme but some of my scripts dont work. I have a box being hit by a laser and i want the box to change to the color of the laser when hit by it. So this is the code on the block: e.this.color := e.other.color But it doesn't work so please help. Also what does the maxrays thing do and is there a way to split lasers?
I won't be on the forums much for a while. But maybe once in a while.
User avatar
HavingPhun
 
Posts: 178
Joined: Sun Feb 06, 2011 10:42 pm

Re: color change help

Postby TC42 » Sun Apr 03, 2011 3:08 pm

e.geom.color, not e.other.color when working with lasers. Other is for collisions, geom is for lasers.
Maxrays is the number of rays a laser can have. A laser with a thousand maxrays can be split 1000 times. So if you set the maxrays to one, you can put the laser inside a transparent object, and the laser will only hit the object once, and will only hit that object. Play around with maxrays, you will get interesting results.
Image
Spambot wrote:Nowadays, memes usually are studied less in the field of biology, but more with the arena of psychology along with sociology. But, the major area of a meme, getting embraced and imitated all the time is what’s at any core connected with any meme.
User avatar
TC42
 
Posts: 984
Joined: Sun Jan 09, 2011 1:53 pm
Location: $ sudo apt get-install sandwich_

Re: color change help

Postby HavingPhun » Sun Apr 03, 2011 3:20 pm

thanks and how do you split lasers?
Edit: even if I change it to e.this.color := e.geom.color it still does not work!!! :evil:
I won't be on the forums much for a while. But maybe once in a while.
User avatar
HavingPhun
 
Posts: 178
Joined: Sun Feb 06, 2011 10:42 pm

Re: color change help

Postby TC42 » Sun Apr 03, 2011 4:08 pm

It should be = not := , and you can split lasers using transparent and partially transparent objects.
Ohhh, so you want the code in the box, not the laser, right?

So the code for the box would be
Code: Select all
onhitbylaser= (e)=>{color=e.laser.color}

So it's
e.laser: laser hitting object
e.geom: the object hit
e.other: used for collisions
Image
Spambot wrote:Nowadays, memes usually are studied less in the field of biology, but more with the arena of psychology along with sociology. But, the major area of a meme, getting embraced and imitated all the time is what’s at any core connected with any meme.
User avatar
TC42
 
Posts: 984
Joined: Sun Jan 09, 2011 1:53 pm
Location: $ sudo apt get-install sandwich_

Re: color change help

Postby HavingPhun » Sun Apr 03, 2011 4:19 pm

works now thanks TC42
I won't be on the forums much for a while. But maybe once in a while.
User avatar
HavingPhun
 
Posts: 178
Joined: Sun Feb 06, 2011 10:42 pm


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 7 guests