if my jet passes through the same location where there was a previous collision with my missile and opponent plane ( an sprite sheet showing explosion is played ) … the jet aslo explodes
function plane:preCollision( event ) local platform = event.other if platform.myName == "missile" then event.contact.isEnabled = false if self.isVisible == true then targetsDestroyed = targetsDestroyed +1; explosion.xScale = 1; explosion.yScale = 1; explosion.x = self.x; explosion.y = self.y; explosion.isVisible = true; explosion:play(); end self.isVisible = false end if platform.myName == "jet" then event.contact.isEnabled = false explosion.xScale = 1; explosion.yScale = 1; explosion.x = self.x; explosion.y = self.y; explosion.isVisible = true; explosion:play(); self.isVisible = false jet.isVisible=false if jet.collided == false then jet.collided = true jet.bodyType = "static" applyForceToJet = false gameOver() end end if platform.myName == "shieldCover" then event.contact.isEnabled = false if self.isVisible == true then if shieldCover.isVisible == true then targetsDestroyed = targetsDestroyed +1; explosion.xScale = 1; explosion.yScale = 1; explosion.x = self.x; explosion.y = self.y; explosion.isVisible = true; explosion:play(); self.isVisible = false end end end end plane:addEventListener( "preCollision" )