Skip to content

Instantly share code, notes, and snippets.

@defHLT
Last active December 25, 2015 21:09
Show Gist options
  • Save defHLT/7040140 to your computer and use it in GitHub Desktop.
Save defHLT/7040140 to your computer and use it in GitHub Desktop.
-- destroyer sensor
local sensor_b = world:addBody(MOAIBox2DBody.STATIC)
sensor_f = sensor_b:addRect( STAGE_W/2, 0, -STAGE_W/2, 50)
sensor_b:setTransform( 0, -STAGE_H/2 - 60 )
sensor_f:setSensor(true)
sensor_f:setCollisionHandler(
function(event, fa, fb)
local body = fb:getBody()
local prop = body.prop
mainLayer:removeProp(prop)
body:destroy()
end
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment