Hi. What I was doing is basically doing is having a box that shoots bullets and goes down. My problem that I’ve been trying to solve is how to have the box be destroyed when it comes to contact with the floor.
Here is the plug snd play code to see the problem
[code]local physics = require( “physics” )
physics.start()
local box3 = display.newRect(160, 100, 30, 30)
physics.addBody(box3, “static”,{density = 0, bounce = 0.3, friction = 0})
local box2 = display.newRect(0, 470, 320, 30)
box2.hit = “box2”
physics.addBody(box2, “static”,{density = 0, bounce = 0, friction = 0})
local function bullet (event)
bull = display.newRect(200, 240, 30, 30)
bull.x = box3.x + 50
bull.y = box3.y + 15
transition.to (bull, {time=3000, y=550})
physics.addBody(bull,{density = 0, bounce = 0.3, friction = 0})
bull:addEventListener(“collision”, bull)
function bull:collision (event)
if event.other.hit ~= “box2” then
bull:removeSelf()
end
end
end
timer.performWithDelay(1000, bullet, -1) [/code]
I’ve been trying for hours to try and figure out how to remove the bullet on collision with ground. Any one please help is appreciated
[import]uid: 17058 topic_id: 22055 reply_id: 322055[/import]