W
whale_cancer
Guest
Hello!
This is part of my map loading code. I need to destroy all of the currently placed doors before placing the doors from the map save file. I thought this would work...
However, this only destroys HALF of the of the instances each time I run it! I don't get it. Any help?
Edit: Console output:
This is part of my map loading code. I need to destroy all of the currently placed doors before placing the doors from the map save file. I thought this would work...
Code:
//delete all existing doors
tR = instance_number(obj_door)
show_debug_message(string(tR)+' doors to destroy');
dC = 0
for (i = 0; i < tR; i += 1)
{
with (instance_find(obj_door,i))
{
instance_destroy();
show_debug_message('Destroying door at '+string(x)+','+string(y))
other.dC += 1
}
}
show_debug_message(string(dC)+' doors actually destroyed.');
Edit: Console output:
Code:
4 doors to destroy
Destroying door at 64,64
Destroying door at 112,96
2 doors actually destroyed.