Problems with OnCollide color changing

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

Problems with OnCollide color changing

Postby JDKmedeng » Sun Dec 13, 2009 10:54 pm

Hey, I'm new to scripting, so I did a little searching and saw that in order to make something change color when it collides with something you just type in the script menu (e)=>{color = [1.0, 0.0, 0.0, 1.0]} under onCollide, with the numbers that give your desired color. So I did this, and when I run the simulation, it does nothing. Please help :/

EDIT: For some reason, it is just now working... I tried it about 10 times before with no success... I changed nothing, and now it works... Sorry :/
User avatar
JDKmedeng
 
Posts: 37
Joined: Mon Nov 30, 2009 2:03 am

Re: Problems with OnCollide color changing

Postby standardtoaster » Sun Dec 13, 2009 11:31 pm

Odd. Are you sure that you didn't spell it colour? It will make a difference. You have to use color. To change the other objects color you use e.other.
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm

Re: Problems with OnCollide color changing

Postby JDKmedeng » Mon Dec 14, 2009 1:12 am

Yeah, it's working now. But I have another problem: can I change the colors of everything in a group?
User avatar
JDKmedeng
 
Posts: 37
Joined: Mon Nov 30, 2009 2:03 am

Re: Problems with OnCollide color changing

Postby standardtoaster » Mon Dec 14, 2009 2:14 am

You can.
Code: Select all
scene.my.color = [1,1,1,1]

Put
Code: Select all
{scene.my.color}

Into the color part of the script menu of each object in the group.
Code: Select all
scene.my.color = [x,x,x,x]

x = any float value between 0 and 1
User avatar
standardtoaster
 
Posts: 606
Joined: Mon Aug 31, 2009 7:57 pm


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 4 guests

cron