N
Noba
Guest
So I have this code, which creates some explosion objects after an enemy dies.
I'm aware I can use particles, but I find them a bit awkward to set up, so.
Anyway, this code works fine, but when the alarm in the main explosion object comes to destroy all the instances created, it only destroys one. I'm assuming that's because of the myexplosion variable, but I'm not sure what to do in it's place. I was wondering if there was a way to store all the ids of instances created by this object, and then using that to destroy them. Is this even possible?
Code:
///@desc create the bullet objects
if(explosiontype = 1){ //if the type of explosion is the first one...
if(explosioncolour = 1){//if the colour is 1 (white)
if(amountcreated < repeatamount){//if the amount of explosion fx created is less than the repeat amount
repeat(repeatamount){//create another instance and add 1 amountcreated till amountcreated is greater than repeatamount
myexplosion = instance_create_layer(x,y,"Instances",oWhite);
myexplosion.direction = random_range(0,360);
myexplosion.image_angle = myexplosion.direction + 90;
amountcreated += 1;
}
}
}
if(alarm[0] == -1){
alarm[0] = 70; //use this to destroy all created instances then destroy the base object
}
}
Anyway, this code works fine, but when the alarm in the main explosion object comes to destroy all the instances created, it only destroys one. I'm assuming that's because of the myexplosion variable, but I'm not sure what to do in it's place. I was wondering if there was a way to store all the ids of instances created by this object, and then using that to destroy them. Is this even possible?