Okay, this is the smoke-spawn code I came up with, huge credit to Gear97. It uses his trick to place dynamic values in spawning so that they stay there. This allows lots of circles to be spawned, fade out, and delete without colliding.
- Code: Select all
(scene.addCircle({
texture := "radial-white-transp.png";
drawBorder := false;
drawCake := false;
textureMatrix := [0.50000000000000000, 0.00000000000000000, 0.50000000000000000, 0.00000000000000000, 0.50000000000000000, 0.50000000000000000, 0.00000000000000000, 0.00000000000000000, 1.0000000000000000];
heteroCollide := true;
controllerAcc := sim.time;
pos := e.pos;
vel := [(((scene.addCircle({
collideSet := 0;
airFrictionMult := -inf;
pos := [+inf, +inf]
})).color(0)) - 0.50000000000000000) * 3, (((scene.addCircle({
collideSet := 0;
airFrictionMult := -inf;
pos := [+inf, +inf]
})).color(0)) - 0.50000000000000000) * 1]
})) -> {
color = {[0.20000000000000001, 0.20000000000000001, 0.20000000000000001, 0.50000000000000000 - (((sim.time - controllerAcc) * 1) / 6)]};
collideSet = {{sim.time <= controllerAcc + 3.0099999999999998} ? {32} : {0}};
airFrictionMult = {{sim.time <= controllerAcc + 3.0099999999999998} ? {0.10000000000000001} : {-inf}};
density = {0.0010000000000100003 + (((sim.time - controllerAcc) / 20) / 3)}
}
The circles do collide on E until auto-deletion. I actually don't really know why I did this.
The code is divided into two parts. The first contains things that are not intended to change over time or after a certain amount of time. These include things like pos, vel, and texture.
The second part contains things that are intended to change over or after a certain amount of time. These include things like color and density.
I like to increase density, not airFrictionMult, over time to slow the circles. This is actually more realistic, because smoke actually does get more dense over time, as it cools.