Can anyone tell me why this isn’t working? I get a assertion failed! error when my code reaches the line:
‘event.other:addEventListener (“sprite”, removePeg )’
everything up to that point works as desired, animation plays when
the ball collides with a peg. Static peg runs through animation, then Whammo!
Beuller… Beuller…
ball.collision = function(self,event)
if(event.phase == "ended" ) then
if(event.other.type == "GreenPeg") then
audio.setVolume(.3)
audio.play(ApaddleHit)
event.other:prepare("GreenRemove")
event.other:play("GreenRemove")
event.other:addEventListener ("sprite", removePeg )
end
function removePeg(event)
print(event.phase)
if event.phase == "end" then
local temp = event.target
temp:removeSelf()
temp.target = nil
end
end
[import]uid: 7382 topic_id: 11836 reply_id: 311836[/import]