In my app there is a simple ball controlled by the accelerometer and a static goal on the other end of the screen. I want something to happen when the ball collides with the goal, such as test appearing, or eventually moving to the next level. But for now I will stick to something simple like text appearing. This is what I thought would work:
local function levelComplete(event)
if (event.phase == "began" and event.other.class == "goalZone") then
local winner = display.newText("You have completed the level!", 100, 150 , nil, 24)
end
end
goal.collision = levelComplete
goal:addEventListener("collision", levelComplete)
But when the ball hits the goal, it just bounces off like any other physics object. No text appears. I have been stuck on this for the past couple of days and any help would be greatly appreciated! - Alex [import]uid: 7116 topic_id: 5903 reply_id: 305903[/import]