home *** CD-ROM | disk | FTP | other *** search
- property pInsect, spriteNum, pRotInc, pRotDif, pDistance, pOgLoc, pTimer, pLocation
-
- on getPropertyDescriptionList me
- return [#pRotInc: [#comment: "rotation inc", #format: #integer, #default: 0], #pRotDif: [#comment: "rotation dif", #format: #integer, #default: 0], #pDistance: [#comment: "rotation dis", #format: #integer, #default: 0]]
- end
-
- on beginSprite me
- pInsect = sprite(spriteNum)
- pOgLoc = pInsect.loc
- pLocation = [float(pInsect.locH), float(pInsect.locV)]
- pTimer = 0
- end
-
- on enterFrame me
- pTimer = pTimer + 1
- if pTimer = pDistance then
- pInsect.rotation = pInsect.rotation + (random(pRotInc) - pRotDif)
- pTimer = 0
- end if
- xPos = -sin(float(pInsect.rotation) * PI / 180.0)
- yPos = cos(float(pInsect.rotation) * PI / 180.0)
- pLocation = pLocation + [xPos, yPos]
- pInsect.loc = point(pLocation[1], pLocation[2])
- if (pInsect.locV < (0 - (pInsect.height * 2))) or (pInsect.locV > ((the stage).rect.height + (pInsect.height * 2))) then
- pInsect.rotation = pInsect.rotation - 180
- if pInsect.locV < (0 - pInsect.height) then
- pInsect.locV = 0
- pLocation = [float(pInsect.locH), float(pInsect.locV)]
- else
- pInsect.locV = (the stage).rect.height
- pLocation = [float(pInsect.locH), float(pInsect.locV)]
- end if
- end if
- if (pInsect.locH < (0 - (pInsect.width * 2))) or (pInsect.locH > ((the stage).rect.width + (pInsect.width * 2))) then
- pInsect.rotation = pInsect.rotation + 90
- if pInsect.locH < (0 - pInsect.height) then
- pInsect.locH = 0
- pLocation = [float(pInsect.locH), float(pInsect.locV)]
- else
- pInsect.locH = (the stage).rect.width
- pLocation = [float(pInsect.locH), float(pInsect.locV)]
- end if
- end if
- end
-