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

  1. on initializeConstants
  2.   global dropEffectSO, dropFrames, maximumDrops, beamEffectSO, beamFrames, maximumBeams, cloudEffectSO, cloudFrames, maximumClouds
  3.   dropEffectSO = 100
  4.   dropFrames = 6
  5.   maximumDrops = 30
  6.   beamEffectSO = 30
  7.   beamFrames = 6
  8.   maximumBeams = 0
  9.   cloudEffectSO = 30
  10.   cloudFrames = 6
  11.   maximumClouds = 70
  12. end
  13.  
  14. on initializeDrops
  15.   global dropEffectSO, dropData, dropFrames, maximumDrops
  16.   dropData = []
  17.   repeat with wDrop = 1 to maximumDrops
  18.     wSprite = wDrop + dropEffectSO
  19.     set the loc of sprite wSprite to point(-50, -50)
  20.     add(dropData, [0, point(0, 0), 0, 0, 0, 0, 0])
  21.   end repeat
  22. end
  23.  
  24. on addDrop addLoc, addheight, addGrav
  25.   global dropEffectSO, dropData
  26.   validSlot = 0
  27.   repeat with wScan = 1 to count(dropData)
  28.     if (validSlot = 0) and (dropData[wScan][1] = 0) then
  29.       validSlot = wScan
  30.     end if
  31.   end repeat
  32.   if validSlot <> 0 then
  33.     wSprite = dropEffectSO + validSlot
  34.     dropData[validSlot] = [1, addLoc, addheight, addGrav, random(360), random(50) / 10.0, 0, #Na]
  35.     set the blend of sprite wSprite to 100
  36.     set the loc of sprite wSprite to addLoc
  37.   end if
  38. end
  39.  
  40. on moveBaloon
  41.   global throwState, throwDist, startLoc, TargetLoc, monsterData, monsterhitRange, idleLoc
  42.   if throwDist >= 12 then
  43.     throwState = 0
  44.     throwDist = 0
  45.     repeat with whichDrop = 1 to 15
  46.       addDrop(TargetLoc + point(0, 25), -25, 0 - (random(250) / 10.0))
  47.     end repeat
  48.   end if
  49.   if throwState = 0 then
  50.     repeat with whichMonster = 1 to count(monsterData)
  51.       bPoint = TargetLoc
  52.       if bPoint <> VOID then
  53.         if monsterData[whichMonster][1] = 1 then
  54.           if monsterData[whichMonster][2] = 2 then
  55.             mRect = monsterhitRange[whichMonster]
  56.             if inside(bPoint, mRect) = 1 then
  57.               monsterData[whichMonster][2] = 4
  58.               TargetLoc = VOID
  59.             end if
  60.           end if
  61.         end if
  62.       end if
  63.     end repeat
  64.     idleLoc = point(290, 420) + point((the mouseH - 290) / 3, (the mouseV - 100) / 12)
  65.     set the loc of sprite 131 to idleLoc
  66.     set the width of sprite 131 to 99
  67.     set the height of sprite 131 to 99
  68.   else
  69.     dAim = throwDist * 15
  70.     locX = sin(dAim * PI / 180) * 125
  71.     throwDist = throwDist + 1
  72.     locMod = (startLoc - TargetLoc) / 12.0
  73.     newloc = startLoc - (locMod * throwDist) - point(0, locX)
  74.     modSize = 99 / 15.0
  75.     realSize = modSize * (15 - throwDist)
  76.     set the loc of sprite 131 to newloc
  77.     set the width of sprite 131 to realSize
  78.     set the height of sprite 131 to realSize
  79.   end if
  80. end
  81.  
  82. on moveDrops
  83.   global dropEffectSO, dropData, dropFrames
  84.   warpSides = 0
  85.   splashLocList = []
  86.   repeat with wDrop = 1 to 30
  87.     wSprite = wDrop + dropEffectSO
  88.     dAim = dropData[wDrop][5]
  89.     dSpeed = dropData[wDrop][6]
  90.     if dropData[wDrop][1] = 1 then
  91.       locY = cos(dAim * PI / 180) * -dSpeed / 3.0
  92.       locX = sin(dAim * PI / 180) * dSpeed
  93.       movePoint = point(locX, locY)
  94.       dropData[wDrop][2] = dropData[wDrop][2] + movePoint
  95.       if warpSides = 1 then
  96.         if dropData[wDrop][2][1] > 580 then
  97.           dropData[wDrop][2][1] = dropData[wDrop][2][1] - 580
  98.         end if
  99.         if dropData[wDrop][2][1] < 0 then
  100.           dropData[wDrop][2][1] = dropData[wDrop][2][1] + 580
  101.         end if
  102.         if dropData[wDrop][2][2] > 440 then
  103.           dropData[wDrop][2][2] = dropData[wDrop][2][2] - 440
  104.         end if
  105.         if dropData[wDrop][2][2] < 0 then
  106.           dropData[wDrop][2][2] = dropData[wDrop][2][2] + 440
  107.         end if
  108.       end if
  109.       dropData[wDrop][4] = dropData[wDrop][4] + 2.0
  110.       dropData[wDrop][3] = dropData[wDrop][3] + dropData[wDrop][4]
  111.       dLoc = dropData[wDrop][2] + point(0, dropData[wDrop][3])
  112.       if dropData[wDrop][3] > 0 then
  113.         if (dropData[wDrop][3] > 4) and (random(2) = 1) then
  114.           add(splashLocList, dLoc)
  115.         end if
  116.         dropData[wDrop][1] = 0
  117.         set the loc of sprite wSprite to point(-50, -50)
  118.         addCloud(dLoc, 1 + (random(4) / 10.0))
  119.         next repeat
  120.       end if
  121.       if dropData[wDrop][8] = #Na then
  122.         sprite(wSprite).rotation = 0
  123.       else
  124.         newRotate = findAngle(dLoc, dropData[wDrop][8])
  125.         sprite(wSprite).rotation = newRotate
  126.       end if
  127.       dropData[wDrop][8] = dLoc
  128.       set the loc of sprite wSprite to dLoc
  129.       sprite(wSprite).locZ = dropData[wDrop][2][2]
  130.     end if
  131.   end repeat
  132.   repeat with whichSplash = 1 to count(splashLocList)
  133.   end repeat
  134. end
  135.  
  136. on initializeBeams
  137.   global beamEffectSO, beamData, beamFrames
  138.   beamData = []
  139.   repeat with wBeam = 1 to 30
  140.     wSprite = wBeam + beamEffectSO
  141.     add(beamData, [0, 0])
  142.   end repeat
  143. end
  144.  
  145. on moveBeams
  146.   global beamEffectSO, beamData, beamFrames
  147.   repeat with wBeam = 1 to 30
  148.     if beamData[wBeam][1] = 1 then
  149.     end if
  150.   end repeat
  151. end
  152.  
  153. on initializeClouds
  154.   global cloudEffectSO, cloudData, cloudFrames, maximumClouds
  155.   cloudData = []
  156.   repeat with wCloud = 1 to maximumClouds
  157.     wSprite = wCloud + cloudEffectSO
  158.     add(cloudData, [0, 0, 0, point(0, 0)])
  159.   end repeat
  160. end
  161.  
  162. on addCloud addLoc, addScale
  163.   global cloudEffectSO, cloudData, cloudFrames
  164.   validSlot = 0
  165.   repeat with wScan = 1 to count(cloudData)
  166.     if (validSlot = 0) and (cloudData[wScan][1] = 0) then
  167.       validSlot = wScan
  168.     end if
  169.   end repeat
  170.   if validSlot <> 0 then
  171.     wSprite = cloudEffectSO + validSlot
  172.     cloudData[validSlot] = [1, -40, addScale, addLoc]
  173.     baseSize = (15 + (1 * cloudData[validSlot][2])) * cloudData[validSlot][3]
  174.     set the width of sprite wSprite to baseSize
  175.     set the height of sprite wSprite to baseSize / 3
  176.     set the blend of sprite wSprite to 100
  177.     set the loc of sprite wSprite to addLoc
  178.     sprite(wSprite).locZ = addLoc[2] - integer(baseSize / 3)
  179.   end if
  180. end
  181.  
  182. on moveClouds
  183.   global cloudEffectSO, cloudData, cloudFrames
  184.   repeat with wCloud = 1 to count(cloudData)
  185.     wSprite = cloudEffectSO + wCloud
  186.     if cloudData[wCloud][1] = 1 then
  187.       cloudData[wCloud][2] = cloudData[wCloud][2] + 1
  188.       if cloudData[wCloud][2] > 10 then
  189.         cloudData[wCloud] = [0, 0, 0, point(0, 0)]
  190.         set the loc of sprite wSprite to point(-50, -50)
  191.       end if
  192.     end if
  193.     if cloudData[wCloud][1] = 1 then
  194.       timeC = cloudData[wCloud][2]
  195.       if timeC < 1 then
  196.         timeC = 1
  197.       end if
  198.       baseSize = 75 - ((15 + (2 * timeC)) * cloudData[wCloud][3] * 2)
  199.       set the width of sprite wSprite to baseSize
  200.       set the height of sprite wSprite to baseSize / 2
  201.       set the blend of sprite wSprite to 100
  202.     end if
  203.   end repeat
  204. end
  205.  
  206. on applyMonsters
  207.   global monsterData, spawnDelay
  208.   spawnDelay = spawnDelay + 1
  209.   if spawnDelay > 60 then
  210.     spawnDelay = random(40)
  211.     validSlotList = []
  212.     repeat with whichSlot = 1 to count(monsterData)
  213.       if monsterData[whichSlot][1] = 0 then
  214.         add(validSlotList, whichSlot)
  215.       end if
  216.     end repeat
  217.     repeat with whichMon = 1 to random(3)
  218.       if count(validSlotList) > 0 then
  219.         rPick = random(count(validSlotList))
  220.         pickedSlot = validSlotList[rPick]
  221.         monsterData[pickedSlot] = [1, 1, -75, point(0, 0), 0, 0]
  222.         deleteAt(validSlotList, rPick)
  223.       end if
  224.     end repeat
  225.   end if
  226. end
  227.  
  228. on moveMonsters
  229.   global monsterData, monasterInitialLocs
  230.   monsterSO = 10
  231.   repeat with wMonster = 1 to 12
  232.     wSprite = monsterSO + wMonster
  233.     if monsterData[wMonster][1] = 1 then
  234.       case monsterData[wMonster][2] of
  235.         1:
  236.           if monsterData[wMonster][3] < -25 then
  237.             monsterData[wMonster][3] = monsterData[wMonster][3] + 15
  238.           end if
  239.           if monsterData[wMonster][3] >= -25 then
  240.             monsterData[wMonster][2] = 2
  241.             monsterData[wMonster][3] = -25
  242.             if random(10) = 1 then
  243.               monsterData[wMonster][6] = 2
  244.             else
  245.               monsterData[wMonster][6] = 60
  246.             end if
  247.           end if
  248.           set the loc of sprite wSprite to monasterInitialLocs[wMonster] + point(0, 0 - monsterData[wMonster][3])
  249.           set the member of sprite wSprite to "Target"
  250.         2:
  251.           monsterData[wMonster][6] = monsterData[wMonster][6] - 1
  252.           if monsterData[wMonster][6] <= 0 then
  253.             monsterData[wMonster][2] = 3
  254.           end if
  255.         3:
  256.           if monsterData[wMonster][3] > -100 then
  257.             monsterData[wMonster][3] = monsterData[wMonster][3] - 15
  258.           end if
  259.           if monsterData[wMonster][3] <= -100 then
  260.             monsterData[wMonster][1] = 0
  261.             monsterData[wMonster][2] = 0
  262.             monsterData[wMonster][3] = -100
  263.           end if
  264.           set the loc of sprite wSprite to monasterInitialLocs[wMonster] + point(0, 0 - monsterData[wMonster][3])
  265.         4:
  266.           if monsterData[wMonster][3] > -100 then
  267.             monsterData[wMonster][3] = monsterData[wMonster][3] - 15
  268.           end if
  269.           if monsterData[wMonster][3] <= -100 then
  270.             monsterData[wMonster][1] = 0
  271.             monsterData[wMonster][2] = 0
  272.             monsterData[wMonster][3] = -100
  273.           end if
  274.           set the loc of sprite wSprite to monasterInitialLocs[wMonster] + point(0, 0 - monsterData[wMonster][3])
  275.           set the member of sprite wSprite to "hit"
  276.       end case
  277.     end if
  278.   end repeat
  279. end
  280.