self fading & deleting object -> bug?

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

self fading & deleting object -> bug?

Postby pixartist » Tue Feb 09, 2010 5:01 pm

i create a circle on laserhit:

Scene.addCircle {
collideWater := false;
color := {[0.43, 0.322, 0.366, 1 - ((sim.time - controllerAcc) / 10)]};
drawCake := false;
controllerAcc := Sim.time;
collideSet := 0;
zDepth := 6.0;
pos := e.pos;
angle := -0.6313785;
radius := 0.25;
density := {(sim.time - controllerAcc) < 10 ? {2.0} : {NaN}}
}

this only works for 1 circle at a time.. -> when i spawn 10 circles with a laser like this in a row, only the first will fade and delete itself, why?
Image
pixartist
 
Posts: 65
Joined: Wed Sep 02, 2009 5:30 pm

Re: self fading & deleting object -> bug?

Postby Versieon » Tue Feb 09, 2010 5:15 pm

I wish this worked, and I tryed the same thing.

Dynamic Color Changing

Read this, it gets around it a little, but you cant read off a variable in the spawned object.
User avatar
Versieon
 
Posts: 375
Joined: Tue Sep 01, 2009 4:45 pm

Re: self fading & deleting object -> bug?

Postby pixartist » Tue Feb 09, 2010 6:46 pm

does this mean, that a spawned object can only have one dynamic variable ?
Image
pixartist
 
Posts: 65
Joined: Wed Sep 02, 2009 5:30 pm

Re: self fading & deleting object -> bug?

Postby Kilinich » Tue Feb 09, 2010 11:12 pm

pixartist wrote:i create a circle on laserhit:

Scene.addCircle {
collideWater := false;
color := {[0.43, 0.322, 0.366, 1 - ((sim.time - controllerAcc) / 10)]};
drawCake := false;
controllerAcc := Sim.time;
collideSet := 0;
zDepth := 6.0;
pos := e.pos;
angle := -0.6313785;
radius := 0.25;
density := {(sim.time - controllerAcc) < 10 ? {2.0} : {NaN}}
}

this only works for 1 circle at a time.. -> when i spawn 10 circles with a laser like this in a row, only the first will fade and delete itself, why?


Rating: rated 6.1
Filesize: 20.34 kB
Comments: 4
Ratings: 3
download
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: self fading & deleting object -> bug?

Postby pixartist » Wed Feb 10, 2010 2:18 am

Kilinich wrote:
pixartist wrote:i create a circle on laserhit:

Scene.addCircle {
collideWater := false;
color := {[0.43, 0.322, 0.366, 1 - ((sim.time - controllerAcc) / 10)]};
drawCake := false;
controllerAcc := Sim.time;
collideSet := 0;
zDepth := 6.0;
pos := e.pos;
angle := -0.6313785;
radius := 0.25;
density := {(sim.time - controllerAcc) < 10 ? {2.0} : {NaN}}
}

this only works for 1 circle at a time.. -> when i spawn 10 circles with a laser like this in a row, only the first will fade and delete itself, why?


Rating: rated 6.1
Filesize: 20.34 kB
Comments: 4
Ratings: 3
download


thats exactly what i did isnt it ? where is the difference?

edit: doesnt work if you spawn a lot of objects in a row
Image
pixartist
 
Posts: 65
Joined: Wed Sep 02, 2009 5:30 pm

Re: self fading & deleting object -> bug?

Postby pixartist » Wed Feb 10, 2010 4:49 pm

kilinich, i actually found a way!!!

Code: Select all
Scene.my.spawnball := (e)=>{scene.addcircle({         pos := e.pos;         mark := sim.time;         color := {[1, 1, 1, 1 / (1 + 2 * (sim.time - mark))]};         density := {(sim.time > (mark + 1)) ? NaN : 0.005};         collideset := 0;         drawborder := false;         drawcake := false     }); onCollide = (e)=>{e.other.color = [0, 0, 0, e.other.color(3) / 2];     (e.other.color(3) < 0.1) ? {         e.other.liquify;         scene.erasewater     } : {};     Scene.my.spawnball(e)}}

on the spawner:
Code: Select all
(e)=>{
    e.other.color = [0, 0, 0, e.other.color(3) / 2];     (e.other.color(3) < 0.1) ? {         e.other.liquify;         scene.erasewater     } : {};     Scene.my.spawnball(e) }


this can spawn self-modifying objects at any rate !! IMMA GEENIAS!!

it replaces the script on the spawner everytime an object is created...!
Image
pixartist
 
Posts: 65
Joined: Wed Sep 02, 2009 5:30 pm

Re: self fading & deleting object -> bug?

Postby KarateBrot » Thu Feb 11, 2010 2:36 am

pixartist wrote:kilinich, i actually found a way!!!

this can spawn self-modifying objects at any rate !! IMMA GEENIAS!!

it replaces the script on the spawner everytime an object is created...!


Wow that's actually awesome
Image
User avatar
KarateBrot
 
Posts: 825
Joined: Mon Aug 31, 2009 7:32 pm
Location: Germany


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 0 guests

cron