How can I do this ?
I’ve tried with this code, but it doesn’t run ( the ball continues to collide with the object, a basket, but it doesn’t remove), it displays only the alert.
[code]
shape1={ 32.5,-32 ,27.5 ,32, 23.5, 28, 26.5, -32 }
shape2={ -20.5, 28, -26.5, 32, -30.5, -32, -24.5, -32}
shape3={ -20.5, 28, 23.5, 28, 27.5, 32, -26.5, 32 }
local flag=display.newImage(“basket.png”)
flag.x=display.contentWidth-100
flag.y=display.contentHeight-90
flag.rotation= -60
physics.addBody( flag, “static”, { shape=shape1}, {shape=shape2}, {shape=shape3})
localGroup:insert(flag)
local function onBounce ( self, event )
ball:removeSelf()
media.playEventSound(“Pop.aiff”)
end
flag.collision = onBounce
flag:addEventListener(“collision”, onBounce)
– Alert
local function onComplete( event )
if “clicked” == event.action then
local i = event.index
if 1 == i then
director:changeScene(“level10”)
end
end
end
–collision
local function hitGround (event)
native.showAlert( “Congratulations!!!”, “Go to the next level”, { “Next Level” }, onComplete )
end
end
flag:addEventListener(“collision”, hitGround)
[/code] [import]uid: 27760 topic_id: 30404 reply_id: 330404[/import]
[import]uid: 52491 topic_id: 30404 reply_id: 122094[/import]