S
Siracher
Guest
Hi all
I am using the code below to delete all enemies within the layer "enemies" when the object containing this code is created.
unfortunately there are 2 issues:
- the first created enemy will not be deleted
- the code deletes also some objects within other layers (this is really critical and I don't get why the code is doing this...)
does anybody know what the problem is?
I am using the code below to delete all enemies within the layer "enemies" when the object containing this code is created.
unfortunately there are 2 issues:
- the first created enemy will not be deleted
- the code deletes also some objects within other layers (this is really critical and I don't get why the code is doing this...)
does anybody know what the problem is?
Code:
var layerid = layer_get_id("enemies");
var a = layer_get_all_elements(layerid);
for (var i = 0; i < array_length_1d(a); i++;)
{
deletme = instance_id[i]
instance_create_layer(deletme.x,deletme.y,"Instances",obj_bubbles)
instance_destroy(deletme)
}
audio_play_sound(global.lvl_snd,10,0);
instance_destroy();