What your doing is checking to see if key[2] is being pressed. However, you only want to check if it was triggered. In order to do this you have to keep track of the keys status. your going to need 2 variables keyCurrent and keyOld. During your loop you'll want to update the keys, setting keyOld to keyCurrent and keyCurrent to 0;
keyOld = keyCurrent;
keyCurrent = 0;
now check for key[2]
keyCurrent = dbKeyState(3);
with that you can check if a key is pressed or if its triggered like so
if(KeyCurrent)
{
// key is pressed
}
if(KeyCurrent && !keyOld)
{
// key is triggered
}
Now your code might look like this.
if ((KeyCurrent && !keyOld) && dbObjectCollision(10,11) == 1)
{
Hit = 1;
dbSetObjectSpeed( 10, 30 );
dbPlayObject( 10, 143, 159 );
}
if (Hit == 1 && ObjectHealth != 0)
{
ObjectHealth = (ObjectHealth - 0.12);
Hit = 0;
}
Though that could be cleaned up a lot. I recommend making an input manager. It will have a list of keys to keep track of. It will have functions like getInput, updateKeys, isPressed, isTriggered.