Hi,
I've written a game, which is playable but I need to fix a few minor problems. One of them is in the collision detection.
I have an image(a fly) popping up at random around the screen and when the Frog collides with it, points are supposed to be added to the score and a sound plays. Problem is, the points and sound are playing when the frog is nowhere near the fly, then when the frog gets the fly it doesn't always work.
Here's the code I've used:
Could someone show me where I've gone wrong?Code:Dim GameTop As Single Dim GameLeft As Single 'Code for Bonus Fly Randomize With imgBonusFly GameTop = Rnd * (Height - .Height) GameLeft = Rnd * (Width - .Width) .Move GameLeft, GameTop End With 'Froggy gets Fly If imgBonusFly.Left < imgFrog(FrogIndex).Left + imgFrog(FrogIndex).Width _ And imgBonusFly.Left + imgBonusFly.Width > imgFrog(FrogIndex).Left Then Bonus




Reply With Quote