Function TestShotAst() For a.ast = Each ast For s.shots = Each shots If ImagesCollide(a\img,a\x,a\y,0,s\img,s\x,s\y,0) as.ast = New ast as\x = a\x as\y = a\y as\rot = 0 as\size = a\size + 1 as\img = aimg0(a\rot) as\vx = Rnd(-2,2) as\vy = Rnd(-2,2) a\size = a\size + 1 Delete s End If Next Next End Function
I know I've had this exact same problem before, but I can't remember how I fixed it. Anyways, this is the function in my little Asteroids game that checks to see if the players shot has hit the asteroid. It makes a new asteroid and makes the old one smaller. The problem is, if there is more than one shot on the screen, It gives me an error "Image does not exist" and it highlits the "If ImagesCollide(a\img,a\x,a\y,0,s\img,s\x,s\y,0)" line. I know I've fixed this problem before, and I'm sure it's very simple, but I can't see the problem right now, can anyone else?