PDA

View Full Version : Emitter attachment offsets?


Yen
04-04-2006, 12:14 AM
I've got a particle emitter, which I attach to a player via attr[].

The emitter has the 'attachposition' variable.

However, I want the particles to emit at random points on the player. I'm using a modifier to change the particle's x and y to a random value in reference to the player.

However, when I attach the emitter it doesn't emit when the x/y modifiers are there. I'm assuming it's emitting at 0,0

Is there any other way to do this?

Admins
04-04-2006, 12:53 AM
I guess you need
showimg.attachtoowner = true;
The showimg.emitter.attachposition attribute is only for saying if the particles should automatically move with the emitter or be independend.

Yen
04-04-2006, 01:00 AM
:( That's not making it follow..

Yen
04-04-2006, 01:12 AM
If it helps..

if (created) {
with (findimg(30)) {
x = player.x;
y = player.y;
attachtoowner = true;
layer = 3;

emitter.delaymin = .15;
emitter.delaymax = .15;
emitter.nrofparticles = 1;
emitter.emissionoffset = {1,1.5,0};
emitter.continueafterdestroy = true;
emitter.firstinfront = false;
emitter.particle.lifetime = .5;
emitter.particle.image = "g4_particle_bluex.png";
emitter.particle.red = 0;
emitter.particle.green = 1;
emitter.particle.blue = 0;
emitter.particle.alpha = .9;
emitter.particle.zoom = 1;
emitter.particle.speed = 0;
emitter.particle.angle = pi / 2;

emitter.addlocalmodifier("once", 0, 0, "x", "replace", player.x-1.5, player.x+.5);
emitter.addlocalmodifier("once", 0, 0, "y", "replace", player.y-.5, player.y+1);
emitter.addlocalmodifier("once", 0, 0, "zoom", "replace", .6, 1.2);
emitter.addlocalmodifier("once", 0, 0, "speed", "replace", .8, 3.3);
emitter.addlocalmodifier("once", 0, 0, "spin", "replace", -3, 3);
emitter.addlocalmodifier("range", .3, .5, "alpha", "replace", .9, .3);
}
this.timed = 1.3;
setTimer(.05);
}
if (timeout) {
if (this.timed > 0) {
this.timed -= .05;
if (this.timed <= 0) {
with (findimg(30)) {
emitter.delaymin = emitter.delaymax = 60;
}
}
}
}

I've also tried setting the x and y constantly in the timeout. It doesn't work. :/

Yen
04-04-2006, 01:16 AM
Nevermind, I'm silly.
I made it constantly change the x/y modifier in the timeout, it works now.


And I just noticed I triple posted. Sowwy. <3