Masstertron
Member
Hi everyone!
(GMS 2.3)
I've noticed that using instance_destroy() doesn't work for children objects.
For example, when I use instance_destroy(obj_enemy), my expectation is that all enemies, including child-object enemies (eg: obj_enemy_bird, obj_enemy_fish) are destroyed.
What happens is no enemies are destroyed, because all of the instances in the room are instances of obj_enemy_bird and obj_enemy_fish.
The documentation on instance_destroy() doesn't touch on this subject, but does anyone know if I'm missing something, or if I should simply use this:
The above line works nicely, but instance_destroy() seems more elegant and reliable long-term (if it worked).
Cheers
(GMS 2.3)
I've noticed that using instance_destroy() doesn't work for children objects.
For example, when I use instance_destroy(obj_enemy), my expectation is that all enemies, including child-object enemies (eg: obj_enemy_bird, obj_enemy_fish) are destroyed.
What happens is no enemies are destroyed, because all of the instances in the room are instances of obj_enemy_bird and obj_enemy_fish.
The documentation on instance_destroy() doesn't touch on this subject, but does anyone know if I'm missing something, or if I should simply use this:
GML:
layer_destroy_instances("lyr_enemies");
Cheers