Hi everyone,
I’m making a simple game but I have a problem:
-My jet needs to explode when it collides whit a mine, this works but now i have coins and when the jet collides with a coin in needs to add 1 point.
-How do i make it so that when my jet collides with the mine it explodes and when it collides with the coin it adds a point?
code:
function onCollision(event)
if event.phase == “began” then
if jet.collided == false then
timer.cancel(tmr)
jet.collided = true
jet.bodyType = “static”
explode()
end
end
end
Wrong section - it’s question about Corona, not Lua
It is a question about LUA, because the collision event doesn’t matters 
But back to the question, you should give your mines and coins “names” so you can identify which one you are hitting in the collision event.
For example:
local coin = display.newImage("coin.png", 0, 0) coin.name = "coin" function onCollision(event) if event.phase == "began" then if event.other.name == "coin" then --add point to your counter elseif event.other.name == "mine" then if jet.collided == false then timer.cancel(tmr) jet.collided = true jet.bodyType = "static" explode() end end end end
Hope the helps.
Torben
Wrong section - it’s question about Corona, not Lua
It is a question about LUA, because the collision event doesn’t matters 
But back to the question, you should give your mines and coins “names” so you can identify which one you are hitting in the collision event.
For example:
local coin = display.newImage("coin.png", 0, 0) coin.name = "coin" function onCollision(event) if event.phase == "began" then if event.other.name == "coin" then --add point to your counter elseif event.other.name == "mine" then if jet.collided == false then timer.cancel(tmr) jet.collided = true jet.bodyType = "static" explode() end end end end
Hope the helps.
Torben