obscene
Member
This is weird...
I have a room with two enemies, which fire lasers (obj_laser_blast). They fire at pretty much the same time. So we have two obj_laser_blasts. This APPEARS to be related to the problem, as baiting only one to fire at me does not cause this problem.
obj_laser_blast creates two instances, light and lensflare. And as soon as obj_laser_blast completes it's work it destroys itself as well as obj_light and obj_lensflare.
So this weird thing keeps happening where extra lights and lensflares get left behind after the laser blast. It's impossible, because in my destroy event I have...
So to figure out what's going on I added debug messages when the enemies fire the lasers...
And in my create event I added debug messages to the beginning and end...
So what I discovered is my create event is running two times. Notice the id 116521 appears twice.
And so when the event runs twice, duplicate lights and lensflares are created but the original IDs are overwritten and aren't destroyed in the end.
There is NOTHING in this object that would cause a create event to run twice. Am I correct to assume the only way this would happen is with an event_perform(ev_create,0) call? Because it doesn't exist.
This has driven me absolutely nuts.
I have a room with two enemies, which fire lasers (obj_laser_blast). They fire at pretty much the same time. So we have two obj_laser_blasts. This APPEARS to be related to the problem, as baiting only one to fire at me does not cause this problem.
obj_laser_blast creates two instances, light and lensflare. And as soon as obj_laser_blast completes it's work it destroys itself as well as obj_light and obj_lensflare.
So this weird thing keeps happening where extra lights and lensflares get left behind after the laser blast. It's impossible, because in my destroy event I have...
Code:
with lensflare instance_destroy();
with ambientlight instance_destroy();
show_debug_message("obj_laser_blast destroyed with id " +string(id)); // And I know it runs because of this.
Code:
var laser=instance_create(gunpoint_x,gunpoint_y,obj_laser_blast);
show_debug_message("obj_crawler " +string(id) + " created laser " + string(laser));
with (laser)
{
direction=other.gun_angle;
friendly=false;
}
Code:
/// Initialize
show_debug_message("obj_laser_blast created with id " +string(id));
fired=false;
friendly=false;
impact=false;
lensflare=noone;
impact_x=0;
impact_y=0;
alarm[0]=2;
lensflare=instance_create(x,y,obj_lensflaregenerate);
lensflare.image_alpha=5;
scr_audio_play_sound_at(snd_laser_blast,1,x,y);
ambientlight=instance_create(x,y,obj_light);
particles=global.particles;
with ambientlight
{
image_alpha=1
}
show_debug_message("obj_laser_blast create event completed with id " +string(id));
And so when the event runs twice, duplicate lights and lensflares are created but the original IDs are overwritten and aren't destroyed in the end.
There is NOTHING in this object that would cause a create event to run twice. Am I correct to assume the only way this would happen is with an event_perform(ev_create,0) call? Because it doesn't exist.
This has driven me absolutely nuts.
Last edited: