Evening all.
Another question from someone just starting out with Corona.
I’ve now got my player and item objects jumping around the screen, and I set up a global collisions listener to see if the player collides with any items and reward them for it.
-- score gui
local score = display.newText( "0", player.x, player.y-70, "Helvetica", 34)
local function onCollision(event)
if (event.object1.name == "item" and event.object2.name == "player") then
score.text = score.text + 100
item:removeSelf()
end
end
Runtime:addEventListener ("collision", onCollision)
It all works well and good, however, every so often the collision occurs before the item is removed, and the player smashes directly into it, sending them off in a tangent instead of simply removing the item and allowing them to pass straight through.
Any tips? [import]uid: 81846 topic_id: 14706 reply_id: 314706[/import]
