home *** CD-ROM | disk | FTP | other *** search
- global insectRef_SO, insectRef_Max, insectRef, insectData, insectResetValue, insectTickCounter
-
- on initializeInsects
- insectRef_SO = 120
- insectRef_Max = 3
- insectData = []
- repeat with wIns = 1 to insectRef_Max
- wSprite = insectRef_SO + wIns - 1
- puppetSprite(wSprite, 1)
- set the member of sprite wSprite to "Insect 1"
- set the ink of sprite wSprite to 36
- case random(2) of
- 1:
- xLoc = [0, 5800][random(2)]
- yLoc = random(4400)
- 2:
- xLoc = random(5800)
- yLoc = [0, 4400][random(2)]
- end case
- add(insectData, [point(xLoc, yLoc), random(360), random(7) - 5])
- end repeat
- insectTickCounter = the ticks
- end
-
- on moveInsects
- global InsFrameSwither
- if the ticks >= (insectTickCounter + 1) then
- InsFrameSwither = InsFrameSwither + 1
- if InsFrameSwither > 3 then
- InsFrameSwither = 1
- end if
- insectTickCounter = the ticks
- repeat with wIns = 1 to insectRef_Max
- wSprite = insectRef_SO + wIns - 1
- insectData[wIns][3] = insectData[wIns][3] + random(5) - 3
- if insectData[wIns][3] > 8 then
- insectData[wIns][3] = 8
- end if
- if insectData[wIns][3] < -8 then
- insectData[wIns][3] = -8
- end if
- insectData[wIns][2] = insectData[wIns][2] + insectData[wIns][3]
- moveAim = insectData[wIns][2]
- moveSpeed = 25 + (wIns mod 5 * 3)
- locY = integer(cos(moveAim * PI / 180) * -moveSpeed)
- locX = integer(sin(moveAim * PI / 180) * moveSpeed)
- insectData[wIns][1] = insectData[wIns][1] + point(locX, locY)
- respawnSetting = 1
- if respawnSetting = 1 then
- if insectData[wIns][1][1] > 5800 then
- insectData[wIns][1][1] = insectData[wIns][1][1] - 5800
- end if
- if insectData[wIns][1][1] < 0 then
- insectData[wIns][1][1] = insectData[wIns][1][1] + 5800
- end if
- if insectData[wIns][1][2] > 4400 then
- insectData[wIns][1][2] = insectData[wIns][1][2] - 4400
- end if
- if insectData[wIns][1][2] < 0 then
- insectData[wIns][1][2] = insectData[wIns][1][2] + 4400
- end if
- else
- respawnIt = 0
- if insectData[wIns][1][1] > 5800 then
- respawnIt = 1
- else
- if insectData[wIns][1][1] < 0 then
- respawnIt = 1
- else
- if insectData[wIns][1][2] > 4400 then
- respawnIt = 1
- else
- if insectData[wIns][1][2] < 0 then
- respawnIt = 1
- end if
- end if
- end if
- end if
- if respawnIt = 1 then
- case random(2) of
- 1:
- xLoc = [0, 5800][random(2)]
- yLoc = random(4400)
- 2:
- xLoc = random(5800)
- yLoc = [0, 4400][random(2)]
- end case
- insectData[wIns][1] = point(locX, locY)
- end if
- end if
- sprite(wSprite).rotation = moveAim
- set the loc of sprite wSprite to insectData[wIns][1] / 10
- set the member of sprite wSprite to "insect " & string(((InsFrameSwither + wIns) mod 3) + 1)
- end repeat
- end if
- end
-