home *** CD-ROM | disk | FTP | other *** search
Wrap
global gFrog on isFrogOn theSprite if theSprite.member.name contains "turtle" then if theSprite.rolla then if theSprite.unda then return 0 end if end if end if distX = float(gFrog.locH) - float(theSprite.locH) distY = float(gFrog.locV) - float(theSprite.locV) if distX = 0.0 then distX = 0.0000005 end if if distY = 0.0 then distY = 0.0000005 end if theDir = atan(distY / distX) theMag = sqrt(power(distX, 2) + power(distY, 2)) frogX = cos(theDir) * theMag frogY = sin(theDir) * theMag testLoc = [float(theSprite.locH), float(theSprite.locV)] + [frogX, frogY] if checkForIntersect(theSprite, testLoc) then return 1 else return 0 end if end on checkForIntersect aSprite, aLoc if (aLoc[1] >= (aSprite.left + 15)) and (aLoc[1] <= (aSprite.right - 15)) and ((aLoc[2] >= (aSprite.top + 15)) and (aLoc[2] <= (aSprite.bottom - 15))) then return 1 else return 0 end if end on isFrogOn2 theSprite distX = float(gFrog.locH) - float(theSprite.locH) distY = float(gFrog.locV) - float(theSprite.locV) if distX = 0.0 then distX = 0.0000005 end if if distY = 0.0 then distY = 0.0000005 end if theDir = atan(distY / distX) theMag = sqrt(power(distX, 2) + power(distY, 2)) frogX = cos(theDir) * theMag frogY = sin(theDir) * theMag testLoc = [float(theSprite.locH), float(theSprite.locV)] + [frogX, frogY] if checkForIntersect2(theSprite, testLoc) then return 1 else return 0 end if end on checkForIntersect2 aSprite, aLoc if (aLoc[1] >= aSprite.left) and (aLoc[1] <= aSprite.right) and ((aLoc[2] >= aSprite.top) and (aLoc[2] <= aSprite.bottom)) and (gFrog.locZ > aSprite.spriteNum) then return 1 else return 0 end if end