A problem that I see with the code is that only the first collision will be detected(From my experience if 3 sprites overlap, then SPHITSP will return the sprite with the lowest management number.) For example, for sprites with management number 1,2,3, the collision detected would be (1,2), (2,1) and (3,1). To solve that problem you need to use a loop to call SPHITSP() without arguments.