I happen to be working on the same thing at the moment.
It’s explained pretty well in the beginner tutorials.
Basically on your coin and your hero game objects you have to have a collisionobject and a shape. Then in the collisionobject you need to set their mask and group to something like this:
coin:
group: coin
mask: player
player:
group: player
mask: coin
Also, make sure to set your type appropriately based off your game.
Finally, assuming you had the script on your coin, you would do something like this:
function on_message(self, message_id, message, sender)
-- handle object collision
if message_id == hash("contact_point_response") then
if message.group == hash('player') then
-- give the player his point!
settings.add_point()
-- kill self
go.delete()
end
end
end
Of course adapt you collection logic as needed. Hope that helps, but it’s explained more thoroughly in the manual and the tutorial I linked