When I've dealt with deleting types in the past and freeing entities and such, I've never had any luck unless i do it this way:
1) for whatever type you need to kill off, such as bullet, add a field called 'die'.
2) in your main loops, if an instance of that type is ready to be killed off, set it's 'die' field to true (b\die = true)
3) finally, at the very end of your main loop in a separate for / each loop, check to see if any of your instances "b\die = true" and if so, free their entities and delete them then... just be sure to free the entities first, then delete the type.
here's some pseudo code:
Anyway, give that a shot and see if it helps. Not sure why it never seems to work the other way, but that's usually how i end up having to use it.
cheers,
roland
1) for whatever type you need to kill off, such as bullet, add a field called 'die'.
2) in your main loops, if an instance of that type is ready to be killed off, set it's 'die' field to true (b\die = true)
3) finally, at the very end of your main loop in a separate for / each loop, check to see if any of your instances "b\die = true" and if so, free their entities and delete them then... just be sure to free the entities first, then delete the type.
here's some pseudo code:
Type bullet field entity field die end type while not keyhit(1) ;main update loop for b.bullet = each bullet ;move it, shoot it, etc. next for b.bullet = each bullet if b\die = true freeentity(b\entity) delete b endif next wend
Anyway, give that a shot and see if it helps. Not sure why it never seems to work the other way, but that's usually how i end up having to use it.
cheers,
roland