I'm trying to create a simple Dinossaur Game clone from the Google Chrome easter egg, but I'm facing a little problem.
As soon as the game starts, a contact callback is activated for a contact that has not been performed yet.
Code: Select all
function compareContacts(a, b, nameA, nameB)
if (a:getUserData() == nameA or a:getUserData() == nameB and b:getUserData() == nameA or b:getUserData() == nameB) then
textToPrint = tostring(true)
contactExists = true
return true
else
return false
end
end
function beginContact(a, b, coll)
if (compareContacts(a, b, 'player', 'ground')) then
textToPrint = tostring(true)
contactExists = true
end
if(compareContacts(a, b, 'player', 'block')) then playerLost = true end
end
Any thoughts?
Thank you!