Problem with onCollide script?

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

Problem with onCollide script?

Postby v0xc » Sat Sep 18, 2010 2:36 pm

This is the script I'm using for a circle:
(e)=>{
scene.AddCircle({
pos = e.pos;
radius = 0.2;
color = [1, 1, 0, 1];
collideSet = 5;
heteroCollide = true
})
}

It's working and all but there is a problem, the 'attributes' of the spheres that the circle produces also makes the 'producing circle' have it's attributes. Let's say I have an onCollide script that makes a circle make more circles with a color of yellow and density of 2.0, once the main circle creates a circle, the main circle becomes yellow and have a density of 2.0 too, and I want the main circle to still have it's old attributes. Is there something wrong?
v0xc
 
Posts: 6
Joined: Fri Sep 03, 2010 3:31 pm

Re: Problem with onCollide script?

Postby Mystery » Sat Sep 18, 2010 2:52 pm

Yes, a simple mistake actually.
In thyme "=" means to change an already existing variable. For your purpose you want to create a variable.
":=" Is for creation of new variables.

Code: Select all
(e)=>{
scene.AddCircle({
pos := e.pos;
radius := 0.2;
color := [1, 1, 0, 1];
collideSet := 5;
heteroCollide := true
})
}


Good Luck :thumbup:
User avatar
Mystery
 
Posts: 2802
Joined: Thu Sep 03, 2009 1:16 pm
Location: Southern Australia

Re: Problem with onCollide script?

Postby v0xc » Sat Sep 18, 2010 3:16 pm

Thanks!
v0xc
 
Posts: 6
Joined: Fri Sep 03, 2010 3:31 pm


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 6 guests