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

  1. global insectRef_SO, insectRef_Max, insectRef, insectData, insectResetValue, insectTickCounter
  2.  
  3. on initializeInsects
  4.   insectRef_SO = 130
  5.   insectRef_Max = 3
  6.   insectData = []
  7.   repeat with wIns = 1 to insectRef_Max
  8.     wSprite = insectRef_SO + wIns - 1
  9.     puppetSprite(wSprite, 1)
  10.     set the member of sprite wSprite to "Insect 1"
  11.     set the ink of sprite wSprite to 36
  12.     sprite(wSprite).blend = random(50, 80)
  13.     case random(2) of
  14.       1:
  15.         xLoc = [0, 5800][random(2)]
  16.         yloc = random(4400)
  17.       2:
  18.         xLoc = random(5800)
  19.         yloc = [0, 4400][random(2)]
  20.     end case
  21.     add(insectData, [point(xLoc, yloc), random(360), random(7) - 5])
  22.   end repeat
  23.   insectTickCounter = the ticks
  24. end
  25.  
  26. on moveInsects
  27.   global InsFrameSwither
  28.   if the ticks >= (insectTickCounter + 1) then
  29.     InsFrameSwither = InsFrameSwither + 1
  30.     if InsFrameSwither > 3 then
  31.       InsFrameSwither = 1
  32.     end if
  33.     insectTickCounter = the ticks
  34.     repeat with wIns = 1 to insectRef_Max
  35.       wSprite = insectRef_SO + wIns - 1
  36.       sprite(wSprite).blend = random(50, 80)
  37.       insectData[wIns][3] = insectData[wIns][3] + random(5) - 3
  38.       if insectData[wIns][3] > 8 then
  39.         insectData[wIns][3] = 8
  40.       end if
  41.       if insectData[wIns][3] < -8 then
  42.         insectData[wIns][3] = -8
  43.       end if
  44.       insectData[wIns][2] = insectData[wIns][2] + insectData[wIns][3]
  45.       moveAim = insectData[wIns][2]
  46.       moveSpeed = 25 + (wIns mod 5 * 3)
  47.       locY = integer(cos(moveAim * PI / 180) * -moveSpeed)
  48.       locX = integer(sin(moveAim * PI / 180) * moveSpeed)
  49.       insectData[wIns][1] = insectData[wIns][1] + point(locX, locY)
  50.       respawnSetting = 1
  51.       if respawnSetting = 1 then
  52.         if insectData[wIns][1][1] > 5800 then
  53.           insectData[wIns][1][1] = insectData[wIns][1][1] - 5800
  54.         end if
  55.         if insectData[wIns][1][1] < 0 then
  56.           insectData[wIns][1][1] = insectData[wIns][1][1] + 5800
  57.         end if
  58.         if insectData[wIns][1][2] > 4400 then
  59.           insectData[wIns][1][2] = insectData[wIns][1][2] - 4400
  60.         end if
  61.         if insectData[wIns][1][2] < 0 then
  62.           insectData[wIns][1][2] = insectData[wIns][1][2] + 4400
  63.         end if
  64.       else
  65.         respawnIt = 0
  66.         if insectData[wIns][1][1] > 5800 then
  67.           respawnIt = 1
  68.         else
  69.           if insectData[wIns][1][1] < 0 then
  70.             respawnIt = 1
  71.           else
  72.             if insectData[wIns][1][2] > 4400 then
  73.               respawnIt = 1
  74.             else
  75.               if insectData[wIns][1][2] < 0 then
  76.                 respawnIt = 1
  77.               end if
  78.             end if
  79.           end if
  80.         end if
  81.         if respawnIt = 1 then
  82.           case random(2) of
  83.             1:
  84.               xLoc = [0, 5800][random(2)]
  85.               yloc = random(4400)
  86.             2:
  87.               xLoc = random(5800)
  88.               yloc = [0, 4400][random(2)]
  89.           end case
  90.           insectData[wIns][1] = point(locX, locY)
  91.         end if
  92.       end if
  93.       sprite(wSprite).rotation = moveAim
  94.       set the loc of sprite wSprite to insectData[wIns][1] / 10
  95.       set the member of sprite wSprite to "insect " & string(((InsFrameSwither + wIns) mod 3) + 1)
  96.     end repeat
  97.   end if
  98. end
  99.