home *** CD-ROM | disk | FTP | other *** search
/ 100 Plus Great Games 2 / 100PLUSV2.BIN / games / MachineWar.dxr / 00006_BombScript.ls < prev    next >
Encoding:
Text File  |  2002-01-25  |  5.2 KB  |  179 lines

  1. property pPositionX, pPositionY, pDestPositionX, pDestPositionY, pDestDistance, pDistance, pSpeed, pBType, pChannel, pState, pAngle, pStupidIncrement, pTheStupidKid
  2. global gPath, gPlayer3, gEnemy1, gEnemy2, gEnemy3, gTotalScore, gTotalHealth, gFlagSeised, doChopper
  3.  
  4. on new me, posX, posY, aDistance, speed, bType, channel, theStupidKid, destPositionX, destPositionY
  5.   puppetSound(3, "laser")
  6.   pPositionX = posX
  7.   pPositionY = posY
  8.   pDestDistance = aDistance
  9.   pTheStupidKid = theStupidKid
  10.   if bType = 1 then
  11.     pSpeed = 10
  12.   else
  13.     pSpeed = 5
  14.   end if
  15.   pBType = bType
  16.   pChannel = channel
  17.   if voidp(destPositionX) then
  18.     pAngle = 360 - gPlayer3.pCannonAngle
  19.   else
  20.     pDestPositionX = destPositionX
  21.     pDestPositionY = destPositionY
  22.     pAngle = comeGetSome(pPositionX, pPositionY, pDestPositionX, pDestPositionY)
  23.   end if
  24.   pState = 1
  25.   pDistance = 0
  26.   pStupidIncrement = 0
  27.   sprite(channel).puppet = 1
  28.   sprite(channel).member = "snowBall1"
  29.   sprite(channel).backColor = 6
  30.   sprite(channel).ink = 36
  31.   sprite(channel).loc = point(pPositionX, pPositionY)
  32.   theRotation = 360 - pAngle
  33.   sprite(channel).rotation = theRotation
  34.   pPositionX = pPositionX - (float(sin(pAngle * 3.14000000000000012 / 180)) * pSpeed)
  35.   pPositionY = pPositionY - (float(cos(pAngle * 3.14000000000000012 / 180)) * pSpeed)
  36.   pPositionX = pPositionX - (float(sin(pAngle * 3.14000000000000012 / 180)) * pSpeed)
  37.   pPositionY = pPositionY - (float(cos(pAngle * 3.14000000000000012 / 180)) * pSpeed)
  38.   sprite(channel).loc = point(pPositionX, pPositionY)
  39.   return me
  40. end
  41.  
  42. on getAngle me
  43.   return pAngle
  44. end
  45.  
  46. on updateBomb me
  47.   case pState of
  48.     1:
  49.       moveBomb()
  50.     2:
  51.       fadeBomb()
  52.     3:
  53.   end case
  54. end
  55.  
  56. on getChannel me
  57.   return pChannel
  58. end
  59.  
  60. on moveBomb me
  61.   if sprite(pChannel).intersects(52) and not (pTheStupidKid = 52) then
  62.     if not (gPlayer3.pState = 6) then
  63.       puppetSound(2, "impact")
  64.       if gPlayer3.pIsHoldingObject = 1 then
  65.         gFlagSeised = 0
  66.         gPlayer3.pIsHoldingObject = 0
  67.         if doChopper = 0 then
  68.           sprite(20).loc = point(197, 65)
  69.         end if
  70.       end if
  71.       gPlayer3.pState = 6
  72.       gPlayer3.pStundTime = the ticks
  73.       sprite(68).loc = sprite(52).loc
  74.       sprite(68).rotation = sprite(52).rotation
  75.       pState = 2
  76.     end if
  77.   else
  78.     if sprite(pChannel).intersects(54) and not (pTheStupidKid = 54) then
  79.       if not (gEnemy1.stundTime < 120) then
  80.         sprite(69).loc = sprite(54).loc
  81.         sprite(69).rotation = sprite(54).rotation
  82.         if gEnemy1.pHoldingFlag = 1 then
  83.           puppetSound(2, "impact")
  84.           gFlagSeised = 0
  85.           gEnemy1.pHoldingFlag = 0
  86.           if doChopper = 0 then
  87.             sprite(20).loc = point(197, 65)
  88.           end if
  89.         end if
  90.         gEnemy1.stundTime = 0
  91.         pState = 2
  92.       end if
  93.     else
  94.       if sprite(pChannel).intersects(55) and not (pTheStupidKid = 55) then
  95.         if not (gEnemy2.stundTime < 120) then
  96.           sprite(70).loc = sprite(55).loc
  97.           sprite(70).rotation = sprite(55).rotation
  98.           if gEnemy2.pHoldingFlag = 1 then
  99.             puppetSound(2, "impact")
  100.             gFlagSeised = 0
  101.             gEnemy2.pHoldingFlag = 0
  102.             if doChopper = 0 then
  103.               sprite(20).loc = point(197, 65)
  104.             end if
  105.           end if
  106.           gEnemy2.stundTime = 0
  107.           pState = 2
  108.         end if
  109.       else
  110.         if sprite(pChannel).intersects(56) and not (pTheStupidKid = 56) then
  111.           if not (gEnemy3.stundTime < 120) then
  112.             sprite(71).loc = sprite(56).loc
  113.             sprite(71).rotation = sprite(56).rotation
  114.             if gEnemy3.pHoldingFlag = 1 then
  115.               puppetSound(2, "impact")
  116.               gFlagSeised = 0
  117.               gEnemy3.pHoldingFlag = 0
  118.               if doChopper = 0 then
  119.                 sprite(20).loc = point(197, 65)
  120.               end if
  121.             end if
  122.             gEnemy3.stundTime = 0
  123.             pState = 2
  124.           end if
  125.         end if
  126.       end if
  127.     end if
  128.   end if
  129.   pPositionX = pPositionX - (float(sin(pAngle * 3.14000000000000012 / 180)) * pSpeed)
  130.   pPositionY = pPositionY - (float(cos(pAngle * 3.14000000000000012 / 180)) * pSpeed)
  131.   addparticle(point(pPositionX + (float(sin(pAngle * 3.14000000000000012 / 180)) * pSpeed), pPositionY + (float(cos(pAngle * 3.14000000000000012 / 180)) * pSpeed)), 360 - pAngle)
  132.   sprite(pChannel).loc = point(pPositionX, pPositionY)
  133.   pDistance = pDistance + pSpeed
  134.   if pDistance > pDestDistance then
  135.     pState = 2
  136.   end if
  137. end
  138.  
  139. on fadeBomb me
  140.   pState = 3
  141.   sprite(pChannel).puppet = 0
  142. end
  143.  
  144. on comeGetSome x1, y1, x2, y2
  145.   loc1 = [x1, y1]
  146.   loc2 = [x2, y2]
  147.   deltaX = loc2[1] - loc1[1]
  148.   deltaY = -1 * (loc2[2] - loc1[2])
  149.   if deltaY = 0 then
  150.     if deltaX > 0 then
  151.       return 0
  152.     end if
  153.     if deltaX < 0 then
  154.       return 180
  155.     end if
  156.   end if
  157.   if deltaX = 0 then
  158.     deltaX = 0.01
  159.   end if
  160.   theAngle = atan(float(deltaY) / float(deltaX))
  161.   theAngle = theAngle * 180 / PI
  162.   if (deltaX < 0) and (deltaY > 0) then
  163.     theAngle = 180 + theAngle
  164.   else
  165.     if (deltaX < 0) and (deltaY < 0) then
  166.       theAngle = 180 + theAngle
  167.     else
  168.       if (deltaX > 0) and (deltaY < 0) then
  169.         theAngle = 360 + theAngle
  170.       end if
  171.     end if
  172.   end if
  173.   theAngle = theAngle - 90
  174.   if theAngle < 0 then
  175.     theAngle = 360 + theAngle
  176.   end if
  177.   return theAngle
  178. end
  179.