D
Diveyoc
Guest
Does anyone know how to get the x,y, of a particle burst to follow the tip of a gun. I've used this in multiple scenarios with instances, but this is the first time with particles. I've posted what I think is the relevant code below.
The x,y length_dir code I'm using shoots the flame from the tip of the gun. But when I rotate the gun with the mouse, the point of origin of the emitter stays in the same spot. The flames shoot toward my mouse, it's just the point of origin that does not follow the tip of the gun.
Do I need to work this into the part_emitter_region command somehow? Or is there another command I'm missing?
This particle is activated by holding the shift key.
pdir = point_direction(x, y, mouse_x, mouse_y);
x = (obj_flame_thrower.x + lengthdir_x(20, image_angle));
y = (obj_flame_thrower.y + lengthdir_y(20, image_angle));
//==== PARTICLE SYSTEM ====\\
fire_sys = part_system_create();
part_system_depth(fire_sys,-12000);
//==== FIRE PARTICLE LIGHT GLOW BLENDED ====\\
fire = part_type_create();
part_type_sprite(fire, spr_flame, true, false, true);
part_type_size(fire, 0.2, .5, .02, 0);
part_type_alpha3(fire, 1, .8, .4);
part_type_speed(fire, 12, 16, 0, 1);
part_type_direction(fire, pdir-4, pdir+4, 0, 0);
part_type_orientation(fire, pdir-15, pdir+15, 0, 0, false);
part_type_life(fire, 20, 30);
part_type_blend(fire, 1);
//==== PARTICLE EMITTER ====\\
fire_emit = part_emitter_create(fire_sys);
part_emitter_region(fire_sys, fire_emit, x-1, x+1, y-1, y+1, ps_shape_ellipse, ps_distr_linear);
part_emitter_burst(fire_sys, fire_emit, fire, 8);
The x,y length_dir code I'm using shoots the flame from the tip of the gun. But when I rotate the gun with the mouse, the point of origin of the emitter stays in the same spot. The flames shoot toward my mouse, it's just the point of origin that does not follow the tip of the gun.
Do I need to work this into the part_emitter_region command somehow? Or is there another command I'm missing?
This particle is activated by holding the shift key.
pdir = point_direction(x, y, mouse_x, mouse_y);
x = (obj_flame_thrower.x + lengthdir_x(20, image_angle));
y = (obj_flame_thrower.y + lengthdir_y(20, image_angle));
//==== PARTICLE SYSTEM ====\\
fire_sys = part_system_create();
part_system_depth(fire_sys,-12000);
//==== FIRE PARTICLE LIGHT GLOW BLENDED ====\\
fire = part_type_create();
part_type_sprite(fire, spr_flame, true, false, true);
part_type_size(fire, 0.2, .5, .02, 0);
part_type_alpha3(fire, 1, .8, .4);
part_type_speed(fire, 12, 16, 0, 1);
part_type_direction(fire, pdir-4, pdir+4, 0, 0);
part_type_orientation(fire, pdir-15, pdir+15, 0, 0, false);
part_type_life(fire, 20, 30);
part_type_blend(fire, 1);
//==== PARTICLE EMITTER ====\\
fire_emit = part_emitter_create(fire_sys);
part_emitter_region(fire_sys, fire_emit, x-1, x+1, y-1, y+1, ps_shape_ellipse, ps_distr_linear);
part_emitter_burst(fire_sys, fire_emit, fire, 8);