home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / PadHop.dxr / Internal_7.ls < prev    next >
Encoding:
Text File  |  2002-01-31  |  1.7 KB  |  67 lines

  1. global gFrog
  2.  
  3. on isFrogOn theSprite
  4.   if theSprite.member.name contains "turtle" then
  5.     if theSprite.rolla then
  6.       if theSprite.unda then
  7.         return 0
  8.       end if
  9.     end if
  10.   end if
  11.   distX = float(gFrog.locH) - float(theSprite.locH)
  12.   distY = float(gFrog.locV) - float(theSprite.locV)
  13.   if distX = 0.0 then
  14.     distX = 0.0000005
  15.   end if
  16.   if distY = 0.0 then
  17.     distY = 0.0000005
  18.   end if
  19.   theDir = atan(distY / distX)
  20.   theMag = sqrt(power(distX, 2) + power(distY, 2))
  21.   frogX = cos(theDir) * theMag
  22.   frogY = sin(theDir) * theMag
  23.   testLoc = [float(theSprite.locH), float(theSprite.locV)] + [frogX, frogY]
  24.   if checkForIntersect(theSprite, testLoc) then
  25.     return 1
  26.   else
  27.     return 0
  28.   end if
  29. end
  30.  
  31. on checkForIntersect aSprite, aLoc
  32.   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
  33.     return 1
  34.   else
  35.     return 0
  36.   end if
  37. end
  38.  
  39. on isFrogOn2 theSprite
  40.   distX = float(gFrog.locH) - float(theSprite.locH)
  41.   distY = float(gFrog.locV) - float(theSprite.locV)
  42.   if distX = 0.0 then
  43.     distX = 0.0000005
  44.   end if
  45.   if distY = 0.0 then
  46.     distY = 0.0000005
  47.   end if
  48.   theDir = atan(distY / distX)
  49.   theMag = sqrt(power(distX, 2) + power(distY, 2))
  50.   frogX = cos(theDir) * theMag
  51.   frogY = sin(theDir) * theMag
  52.   testLoc = [float(theSprite.locH), float(theSprite.locV)] + [frogX, frogY]
  53.   if checkForIntersect2(theSprite, testLoc) then
  54.     return 1
  55.   else
  56.     return 0
  57.   end if
  58. end
  59.  
  60. on checkForIntersect2 aSprite, aLoc
  61.   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
  62.     return 1
  63.   else
  64.     return 0
  65.   end if
  66. end
  67.