Frustrating Code

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

Frustrating Code

Postby Rideg » Tue Sep 13, 2011 8:07 pm

Hello, The following code have been very frustrating to me and I don't know if I'm just tired or if this is just impossible to do. So I've been trying to solve this, basically what I want it to do is to change the color of an object when it collides and then make it more transparent as the time pass. This just make it go black and not having a dynamic variable as a color. If you have fast eyes you can spot the the dynamic variable is applied and removed in ~two frames. Please help as this is really starting to get on my nerves.

Code: Select all
(e)=>{
    e.other.textureMatrix(8) == 1995 ? {
        e.this.refractiveIndex == 1995 ? {
            e.this.textScale = sim.time;
            e.this.color = {[0, 0, 0, 1 - (sim.time - textScale)]}
        } : {e.this.textScale = e.this.textScale + 2}
    } : {};
    e.other.textureMatrix(8) == 1995 ? {e.this.textScale = e.this.textScale + 1} : {}
}


Thanks for any kind of help.
Image
make sure to check out my work.
User avatar
Rideg
 
Posts: 948
Joined: Tue Dec 15, 2009 5:17 pm
Location: Östersund, Sweden

Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 2 guests