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

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