destroying objects in collisions

BlitzMax Forums/BlitzMax Beginners Area/destroying objects in collisions

Ryan Burnside(Posted 2006) [#1]
Ok I'm totally new to image collisions, usually I just do a point_distance check. My objects are drawing to buffers and testing their sprites against them. My question is how do I destroy the object drawing the image to the buffer.

Basically I have shots drawing to a buffer and ships testing their sprites against the buffer. How do I destroy the shots upon ship collision?
I think I might be doing this wrong: left_sprite is the ship image. How do i destroy the bullet that it is colliding with?
If CollideImage(left_sprite,x,y,0,2,0)
		lives:-1
		
EndIf



skidracer(Posted 2006) [#2]
I would use a destroyed field that says the shot object is dead and test against that.


Ryan Burnside(Posted 2006) [#3]
I'm not sure what you mean exactly.


H&K(Posted 2006) [#4]
He means attach to each bullet (prefferably in the bullet type) a destroyed variable, then when you come to do the bullet each frame you looksee if the bullet has been destroyed, and if so destroy it


Grey Alien(Posted 2006) [#5]
or just delete it immediately when the object is dead (you are using lists or arrays of objects right?), depends if you want an explosion anim or not. If you need a "death" anim, then have a flag called dead, and when drawing the objects to the collision layer, don't draw it if dead=1, but still draw to the screen except use a different graphic (a death anim). All this stuff is in my AOTMG demo which is part of my Game Framework.


Ryan Burnside(Posted 2006) [#6]
Ok thanks guys. :)