We are suppose to make a slider game where the frog touches the fly. When the frog touches the fly it is to increase the score by one, When the frog touches a mushroom the health is to decrease by 1. However, when the frog touched either one the score increases or decreases accordingly, but instead of by 1 it is by several times. Is there a way to limit it so it only increases by one instead of continuing to count until the sprites are no longer touching?
This happens because the collision lasts longer than a split second so the frog is touching the fly through multiple cycles of the draw loop and each time the score will increase by one (or the health will decrease by 1).
There are a number of ways to “fix” this. The one I usually use is to “move” one of the colliding sprites to another position right after the collision (off the screen, for example), however, there are other ways.
Here is a previous thread where some of these other methods are discussed. U3L16 - Collision score - limiting to +1
Hope that helps!!!
Mike
OK, I tried moving them. and that worked. I will have the kids work at it and see if they can problem solve the issue. thanks.