deleting sprites such as bullet holes

Blitz3D Forums/Blitz3D Programming/deleting sprites such as bullet holes

D_Town_Tony(Posted 2004) [#1]
In the shooter I'm working on if you hit a wall, or a crate, or pretty much anything bullet holes appear. They are merely just sprites aligned to whater surface was selected using the pick commands. My question is that after a while I have them fading away which works great but if the the object they are on gets destroyed the holes are just floating there. Any idea on how to make the sprites on an object delet when the object is destroyed, I have tried just parenting them to whatever object is picked, and that works if the sprites aren't updated(ie fading) but if they are I get a entity does not exist error. Any suggestions.


OrcSlayer(Posted 2004) [#2]
Off the top of my head, the approch I'm going to try is to give the mark type an "owner" param which is whatever object the bullet/whatever collided with. I will then parent it to the owner, and check each update to see if the owner still exists. If it doesn't, I'll free the sprite and delete the mark. Not sure where the entity does not exist error is coming from...I'm going to try coding my mark code tonight, I'll let you know if I make it work this way.


jfk EO-11110(Posted 2004) [#3]
I use a homebrew "UnParent" Function. This function will check all Sprites if they are children of the object I plan to delete. I will then unparent them, using entityparent spritehandle,0, then I position them a long way off the scene (16000,16000,16000 or something, where they won't disturb), then I delete the object as usual. The sprites will then be faded, recycled and so on as usual.


OrcSlayer(Posted 2004) [#4]
Of course, never though about the side effects of deleting a parent while the child still exists. So I guess what I'll be doing is have the object itself delete my marks before it is destroyed. That should work...