home *** CD-ROM | disk | FTP | other *** search
- global gLives, gScore, gObjectList, gLevel
-
- on prepareMovie
- gLives = 5
- gScore = 0
- gLevel = 1
- member("gLives").text = string(gLives)
- member("gScore").text = string(gScore)
- end
-
- on rotateAroundPoint theLoc, pivotPoint, numDegrees
- pivotPoint.locV = pivotPoint.locV - 4
- theAngle = getAngle(pivotPoint, theLoc)
- theRadius = getDistance(pivotPoint, theLoc)
- theAngle = theAngle + numDegrees
- radAngle = theAngle * PI / 180.0
- oX = cos(radAngle) * float(theRadius)
- oY = -sin(radAngle) * float(theRadius)
- return pivotPoint + point(oX, oY)
- end
-
- on getDistance p1, p2
- diff = p2 - p1
- return sqrt(power(diff[1], 2) + power(diff[2], 2))
- end
-
- on getAngle loc1, loc2
- deltaX = loc2[1] - loc1[1]
- deltaY = -1 * (loc2[2] - loc1[2])
- if deltaY = 0 then
- if deltaX > 0 then
- return 0
- end if
- if deltaX < 0 then
- return 180
- end if
- end if
- if deltaX = 0 then
- deltaX = 0.01
- end if
- theAngle = atan(float(deltaY) / float(deltaX))
- theAngle = theAngle * 180 / PI
- if (deltaX < 0) and (deltaY > 0) then
- theAngle = 180 + theAngle
- else
- if (deltaX < 0) and (deltaY < 0) then
- theAngle = 180 + theAngle
- else
- if (deltaX > 0) and (deltaY < 0) then
- theAngle = 360 + theAngle
- end if
- end if
- end if
- return theAngle
- end
-