Destroy both Collided objects
TangoDownStudios
Member Posts: 46
I have a bullet that hits a target, on collision both objects are ruled destroy themselves. The problem is that when the bullet hits the object the object recognizes the bullet hit it, destroys itself and when collision detection is performed on the bullet there is no object and so the bullet goes on its merry way not knowing it hit something. If I set a timer to fix this situation (e.g. not allowing the object to destroy itself for 0.1 seconds etc...) it introduces the problem of more than one bullet being destroyed if they hit in rapid succession.
I have multiple bullet/targets on the screen at the same time. How would I make it so these spawned bullets destroy themselves AND their targets (spawned too)
I have multiple bullet/targets on the screen at the same time. How would I make it so these spawned bullets destroy themselves AND their targets (spawned too)
Comments
then in the objec when object overlaps with bullet destroy
that way it wont get destroyed by a invisble bullet per say.
In theory, it should be working. You may try setting up an attribute that when the bullet collides with the enemy to add to the bulletcount attribute, when that count reaches a certain number to destroy that enemy. Even if that number is 1 bullet. Give that a try?
I have my bullet object moving through the scene
I have my wall object standing there
Bullet hits wall object
Wall registers its been hit and destroys self
Bullet does not register it hit a wall because wall has been destroyed
Bullet travels on
I set a value in bullet to change as the bullet hits a wall but since the wall is never detected this value is useless
I can set a value in wall to go on when it gets hit will a bullet (WallDestroyed=1 e.g.) and will destroy itself over say... 0.1 seconds. But bullets hitting it before it gets destoyed will die too.
I would have to set a global variable to check if the wall a bullet is hitting has been hit already or not. And I don't know a good way of doing this
Basically I want to know how you would do what you recommended john:
"only have the object destroy open collosion with the bullet when bulleton=1"
How does the wall know when bulleton is 1?
then just make sure you only have collosion occur when both alphas are 1. Youll need a wall on attribute for the wall as well. changing wall on to 1 when alpha=1 otherwise change wallon to 0
edit: for your question how does it know when bullet on is1. in the rule that has when object collides with bullet destryo, have the rule when bullet collides with object AND bullet on=1 destroy. and if you need to add the extra rule for the wall the rule should be when bulleton=1 and wallon=1 and object collides with bullet destroy.
try the first way first with those rles, withouth adding the extra attriubtute for the wall and such and see if that works first
plus this introduces the problem of the bullet checking the walls alpha, and vice versa
my emails papiomitis at yahoo dot com
also a screenshot of the rules would help