View Full Version : Sub-Emitters

12-31-2006, 08:43 AM
So, I was reading the fine wiki, and I noticed that you can have particles emit other particles. (Called sub-emitters)


Yet, when I set up a script to do just this... the sub-emitter ceases to emit particles (lending doubt to the notion that they really exist)

I've put some sample code together here:

function onCreated() {
function test() {
//Create the Showimg for the particle effects
with(findimg(100)) {
//Position in the middle of the viewing screen
x = screenwidth/2;
y = screenheight/2;
layer = 4;
//Set up the main emitter
with(emitter) {
particle.speed = 100;
particle.angle = 0;
particle.alpha = 1;
particle.image = "bomb.png";
particle.spin = 0;
particle.lifetime = 10;
particle.movementvector = {20,0,0};
attachposition = true;
autorotation = false;
cliptoscreen = true;
wraptoclippingbox = true;
delaymin = 1;
delaymax = 1;
nrofparticles = 1;
maxparticles = 10;
//Set up the so called 'sub emitter'
with(particle.emitter) {
particle.alpha = .5;
particle.speed = 100;
particle.image = "bomb.png"
particle.lifetime = 10;
particle.movementvector = {0,20,0};
delaymin = 1;
delaymax = 1;
nrofparticles = 1;
maxparticles = 5;

This should have bombs coming out horizontally (moving right) and those bombs should emit other bombs vertically (moving down)... However only the horizontal bombs show up.

If this code is wrong some how, I welcome anyone to fix it, because this issue its truly perplexing. If sub-emitters are indeed a valid Gscript2 construct, that I would think this code would work. But since it does not, there must be something wrong with it that I can't see anymore having looked at it too long. Fresh perspectives welcome :)

01-01-2007, 08:17 AM
I suppose it would be useful to know the minimum amount of attributes one needs to specify for an emitter to emit particles. If both of those code blocks follow that rule, then both of the emitters should emit particles... I believe since the primary emitter emits the bombs, then it would stand to reason that the other emitter should emit particles as well. I've experimented more, but I cannot make the sub-emitter emit particles. Hopefully someone has experienced this problem before and has been able to solve it?

01-02-2007, 10:53 PM
Normally they should work but I have not got time to test them yet