http://img513.imageshack.us/i/triangle.png/
Look at that picture, when you tap the part thats not the triangle it will still delete. I need it to where when the only the actual triangle is hit will it delete.
------------------------------------------------
display.setStatusBar(display.HiddenStatusBar)
local physics = require("physics")
physics.start()
physics.setGravity(0, 9.7)
------------------------------------------------
rectangleShape = { -52.5,-10.5, -42.5,-20, 35.5,-20, 45.5,-9.5, 46,8.5, 36,16.5, -42.5,17, -52.5,8 }
rectangle2Shape = { -18,-21, -8.5,-31, 9,-31, 18.5,-21.5, 18.5,21.5, 10,30, -7.5,30, -18,19.5 }
rectangle3Shape = { -59.5,-6, -51,-12.5, 44,-12.5, 55.5,-7.5, 55.5,6, 44,13, -51.5,13, -59.5,6 }
squareShape = { -29,-17, -19,-26.5, 11.5,-26.5, 21,-16.5, 21,12, 12,21, -19.5,21, -28.5,11.5 }
square2Shape = { -19.5,-11.5, -13,-20.5, 8.5,-20.5, 16.5,-11.5, 15.5,7.5, 9,17, -12.5,17, -20,5.5 }
triangleShape = { -5,-23, 2.5,-23, 24,15, 20,19.5, -22,19.5, -25.5,15.5 }
starShape = { -19,-4.5, 0,-18, 19.5,-3.5, 12,18, -11,18 }
goalShape = { -35,-6, 35,-6, 35,6, -35,6 }
-----------------------------------------------
local removeBody = function( event )
local t = event.target
local phase = event.phase
if(event.phase=="began") then
event.target:removeSelf()
end
return true
end
--------------------------------------------------
local background = display.newImage("background.png")
local ground = display.newImage("base.png")
ground.x = 240
ground.y = 317
physics.addBody(ground, "static", { friction = .5, bounce = .2} )
local reset = display.newImage("reset.png")
reset.x = 20
reset.y = 20
local borderLeft = display.newImage("borderside.png")
borderLeft.x = 0
borderLeft.y = 161
borderLeft.rotation = -90
physics.addBody(borderLeft,"static", borderBodyElement )
local borderRight = display.newImage("borderside.png")
borderRight.x = 480
borderRight.y = 161
borderRight.rotation = -90
physics.addBody(borderRight,"static", borderBodyElement )
local star = display.newImage("star.png")
star.x = 206
star.y = 87
physics.addBody(star, { friction = .3, bounce = .3, shape = starShape} )
local goal = display.newImage("goal3.png")
goal.x = 211
goal.y = 269
physics.addBody(goal, { friction = .4, bounce = .2, density = 0, shape = goalShape} )
-----------------------------------------------
local shapes
rectangle = display.newImage("rectanglenoshad.png")
rectangle.x = 164; rectangle.y = 298
physics.addBody(rectangle, { friction = .3, boucne = .1, density = .1, shape = rectangleShape} )
rectangle:addEventListener( "touch", removeBody )
rectangle.isSleepingAllowed = false
rectangleB = display.newImage("rectanglenoshad.png")
rectangleB.x = 264; rectangleB.y = 298
physics.addBody(rectangleB, { friction = .3, boucne = .1, density = .1, shape = rectangleShape} )
rectangleB:addEventListener( "touch", removeBody )
rectangle3 = display.newImage("rectangle3noshad.png")
rectangle3.x = 211; rectangle3.y = 213
physics.addBody(rectangle3, { friction = .3, boucne = .1, density = .1, shape = rectangle3Shape} )
rectangle3:addEventListener( "touch", removeBody)
rectangle2 = display.newImage("rectangle2noshad.png")
rectangle2.x = 185; rectangle2.y = 169
physics.addBody(rectangle2, { friction = .3, boucne = .1, density = .1, shape = rectangle2Shape} )
rectangle2:addEventListener( "touch", removeBody)
rectangle2b = display.newImage("rectangle2noshad.png")
rectangle2b.x = 232; rectangle2b.y = 167
physics.addBody(rectangle2b, { friction = .3, boucne = .1, density = .1, shape = rectangle2Shape} )
rectangle2b:addEventListener( "touch", removeBody )
square = display.newImage("squarenoshad.png")
square.x = 148; square.y = 251
physics.addBody(square, { friction = .3, boucne = .1, density = .1, shape = squareShape} )
square:addEventListener( "touch", removeBody )
square = display.newImage("squarenoshad.png")
square.x = 276; square.y = 253
physics.addBody(square, { friction = .3, boucne = .1, density = .1, shape = squareShape} )
square:addEventListener( "touch", removeBody )
triangle = display.newImage("triangle.png")
triangle.x = 208; triangle.y = 125
physics.addBody(triangle, { friction = .3, boucne = .1, density = 0, shape = triangleShape} )
triangle.rotation = -180
triangle:addEventListener( "touch", removeBody )
-----------------------------------------------
Again thank you for helping!!!
[import]uid: 10355 topic_id: 6265 reply_id: 22860[/import]