Hey,
my problem is to combine two "types" of particle systems in one room.
The first "type" uses emitters and got a parallax effect and is created on an asset-layer.
The second "type" is created by part_particles_create on an instance-layer.
Both systems work as intended, if the other one is not in the room. If they are placed in the same room, the parallax effect is acting up. Which of the system-"types" is affected, depends on which of the systems is created first and how often. Sometimes the second particle "type" suddenly gets a parallax effect. Sometimes the first type looses its parallax effect. If i delete the code-lines for the parallax effect of the "type" one particles, none of the particles have a parallax effect. So somehow the parallax effect makes it from one system to the other. No idea how. It does not make a difference, if the room is the first in the game or not. Multiple times of entering and exiting the room does not make a difference.
Here the exact example with the code i use:
The persistent object A defines all my particle types like this (just one particle as example. The other particle is also defined in this object in basicly ths same way):
game-start-event:
global.particle_PixelShower = part_type_create();
part_type_sprite(global.particle_PixelShower, sPixelShower, 0, 0, false);
part_type_size(global.particle_PixelShower, 1.0, 1.0, 0, 0);
part_type_speed (global.particle_PixelShower, 2, 4, 0, 0)
part_type_direction (global.particle_PixelShower, 270, 270, 0, 0);
part_type_life (global.particle_PixelShower, 1800, 1800);
part_type_alpha1(global.particle_PixelShower, 0.7);
game-end-event:
part_system_clear(global.particle_PixelShower);
part_type_destroy(global.particle_PixelShower);
Object B creates 7 particle systems of the first "type". The following lines show just one of them as an example, because the other systems are basically the same, they just use slightly other particles (all defined in object A) and use other layers:
create-event:
global.particle_system_pix = part_system_create_layer ("Close_Back",false);
global.emitterPixelShower = part_emitter_create(global.particle_system_pix);
part_emitter_region(global.particle_system_pix, global.emitterPixelShower, 0, room_width, 0, 0, ps_shape_rectangle, ps_distr_linear);
part_emitter_stream(global.particle_system_pix, global.emitterPixelShower, global.particle_PixelShower, 1000);
step-event (updating the particle, so the background is already covert in particles when the room starts):
if (once = 1)
{
repeat(600) {part_system_update(global.particle_PixelShower);}
once--;
}
end-step-event (here goes the parallax effect):
if (instance_exists (oCamera))
{
part_system_position(global.particle_PixelShower, oCamera.x /10, 0);
}
clean-up-event:
part_system_destroy(global.particle_system_pix);
part_emitter_destroy(global.particle_system_pix, global.emitterPixelShower);
Obect C creates the second "type" of particles in its x and y position
create-event:
global.particle_system_lvlTester = part_system_create_layer ("Enemy", false);
step-event:
part_particles_create(global.particle_system_lvlTester, x, y, global.particle_leveltester, 3);
clean-up-event:
part_system_destroy (particle_system_lvlTester);
I banged my head against this problem for almost 20 hours now. You would make my day, if you could help, so thanks in advance.
my problem is to combine two "types" of particle systems in one room.
The first "type" uses emitters and got a parallax effect and is created on an asset-layer.
The second "type" is created by part_particles_create on an instance-layer.
Both systems work as intended, if the other one is not in the room. If they are placed in the same room, the parallax effect is acting up. Which of the system-"types" is affected, depends on which of the systems is created first and how often. Sometimes the second particle "type" suddenly gets a parallax effect. Sometimes the first type looses its parallax effect. If i delete the code-lines for the parallax effect of the "type" one particles, none of the particles have a parallax effect. So somehow the parallax effect makes it from one system to the other. No idea how. It does not make a difference, if the room is the first in the game or not. Multiple times of entering and exiting the room does not make a difference.
Here the exact example with the code i use:
The persistent object A defines all my particle types like this (just one particle as example. The other particle is also defined in this object in basicly ths same way):
game-start-event:
global.particle_PixelShower = part_type_create();
part_type_sprite(global.particle_PixelShower, sPixelShower, 0, 0, false);
part_type_size(global.particle_PixelShower, 1.0, 1.0, 0, 0);
part_type_speed (global.particle_PixelShower, 2, 4, 0, 0)
part_type_direction (global.particle_PixelShower, 270, 270, 0, 0);
part_type_life (global.particle_PixelShower, 1800, 1800);
part_type_alpha1(global.particle_PixelShower, 0.7);
game-end-event:
part_system_clear(global.particle_PixelShower);
part_type_destroy(global.particle_PixelShower);
Object B creates 7 particle systems of the first "type". The following lines show just one of them as an example, because the other systems are basically the same, they just use slightly other particles (all defined in object A) and use other layers:
create-event:
global.particle_system_pix = part_system_create_layer ("Close_Back",false);
global.emitterPixelShower = part_emitter_create(global.particle_system_pix);
part_emitter_region(global.particle_system_pix, global.emitterPixelShower, 0, room_width, 0, 0, ps_shape_rectangle, ps_distr_linear);
part_emitter_stream(global.particle_system_pix, global.emitterPixelShower, global.particle_PixelShower, 1000);
step-event (updating the particle, so the background is already covert in particles when the room starts):
if (once = 1)
{
repeat(600) {part_system_update(global.particle_PixelShower);}
once--;
}
end-step-event (here goes the parallax effect):
if (instance_exists (oCamera))
{
part_system_position(global.particle_PixelShower, oCamera.x /10, 0);
}
clean-up-event:
part_system_destroy(global.particle_system_pix);
part_emitter_destroy(global.particle_system_pix, global.emitterPixelShower);
Obect C creates the second "type" of particles in its x and y position
create-event:
global.particle_system_lvlTester = part_system_create_layer ("Enemy", false);
step-event:
part_particles_create(global.particle_system_lvlTester, x, y, global.particle_leveltester, 3);
clean-up-event:
part_system_destroy (particle_system_lvlTester);
I banged my head against this problem for almost 20 hours now. You would make my day, if you could help, so thanks in advance.