home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / WormFeast.dxr / 00010.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  1.3 KB  |  56 lines

  1. global gLives, gScore, gObjectList, gLevel
  2.  
  3. on prepareMovie
  4.   gLives = 5
  5.   gScore = 0
  6.   gLevel = 1
  7.   member("gLives").text = string(gLives)
  8.   member("gScore").text = string(gScore)
  9. end
  10.  
  11. on rotateAroundPoint theLoc, pivotPoint, numDegrees
  12.   pivotPoint.locV = pivotPoint.locV - 4
  13.   theAngle = getAngle(pivotPoint, theLoc)
  14.   theRadius = getDistance(pivotPoint, theLoc)
  15.   theAngle = theAngle + numDegrees
  16.   radAngle = theAngle * PI / 180.0
  17.   oX = cos(radAngle) * float(theRadius)
  18.   oY = -sin(radAngle) * float(theRadius)
  19.   return pivotPoint + point(oX, oY)
  20. end
  21.  
  22. on getDistance p1, p2
  23.   diff = p2 - p1
  24.   return sqrt(power(diff[1], 2) + power(diff[2], 2))
  25. end
  26.  
  27. on getAngle loc1, loc2
  28.   deltaX = loc2[1] - loc1[1]
  29.   deltaY = -1 * (loc2[2] - loc1[2])
  30.   if deltaY = 0 then
  31.     if deltaX > 0 then
  32.       return 0
  33.     end if
  34.     if deltaX < 0 then
  35.       return 180
  36.     end if
  37.   end if
  38.   if deltaX = 0 then
  39.     deltaX = 0.01
  40.   end if
  41.   theAngle = atan(float(deltaY) / float(deltaX))
  42.   theAngle = theAngle * 180 / PI
  43.   if (deltaX < 0) and (deltaY > 0) then
  44.     theAngle = 180 + theAngle
  45.   else
  46.     if (deltaX < 0) and (deltaY < 0) then
  47.       theAngle = 180 + theAngle
  48.     else
  49.       if (deltaX > 0) and (deltaY < 0) then
  50.         theAngle = 360 + theAngle
  51.       end if
  52.     end if
  53.   end if
  54.   return theAngle
  55. end
  56.