View Single Post
  #1  
Old 06-03-2017, 09:40 AM
Kamaeru Kamaeru is offline
Sandinista!
Kamaeru's Avatar
Join Date: Dec 2001
Posts: 1,040
Kamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud ofKamaeru has much to be proud of
need help with particle scripting

I want to use this in my emitter to draw the particle image at a different 90 degree angle depending on the player's direction. It should work I think, but it doesn't. I'm assuming it only calculates the rotated image once and never again. I can't think of a way to change it though. Is there a way to handle this?

NPC Code:
rotation = (pi / 2) + player.dir * (pi / 2);



To be more specific, I'm working on a script that draws footsteps behind the player when they walk, and to finish it I need to get the footsteps to draw in the correct corresponding direction. Seems like it would be easy, but I just spent a few hours trying to figure it out and failed. It seems like there is no way to change the image or rotate it once the emitter has started. I also couldn't find any documentation explaining how to properly stop an emitter.

NPC Code:
function drawFootSteps() {
this.drawdir = player.dir;

with (findImg(200)) {
attachtoowner = true;
offsetx = 1.0 - vecx(player.dir);
offsety = 1.5 + (vecy(player.dir) * 0.8) + (abs(vecx(player.dir)) * 0.2) - (vecx(player.dir) * 0.15);
layer = 0;

with (emitter) {
delaymin = 0.1;
delaymax = 0.2;
nrofparticles = 1;
continueafterdestroy = true;

with (particle) {
emissionoffset = {0.2 + offsetx,0.2 + offsety,0};

spin = 0;
angle = 0;

rotation = (pi / 2) + this.drawdir * (pi / 2);


image = "bi_effect_footsteps.png";
speed = 0;
mode = 1;

lifetime = 1.2;
alpha = 1;
zoom = 1;
}

addLocalModifier("range",0.5,1.2,"alpha","add",- 0.7,- 0.7);
addLocalModifier("once",0,0,"x","add",- vecy(player.dir) * 0.3,vecy(player.dir) * 0.3);
temp.addy1 = (vecx(player.dir) > 0 ? - vecx(player.dir) * 0.2 : vecx(player.dir) * 0.3);
temp.addy2 = (vecx(player.dir) < 0 ? - vecx(player.dir) * 0.2 : vecx(player.dir) * 0.3);
addLocalModifier("once",0,0,"y","add",temp.addy1,t emp.addy2);
settimer(.05);
}
}
}

__________________
3DS friendcode: 1118-0226-7975
Reply With Quote