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

  1. property pHiding, pEating, pEatCounter, pHit, pHitCounter, spriteNum, pFrameNum, pFrameTimer, pGameOver
  2. global gObjectList, gScore, gLives
  3.  
  4. on beginSprite me
  5.   pFrameTimer = the ticks
  6.   pFrameNum = 1
  7.   gObjectList = []
  8.   pHiding = 0
  9.   pEating = 0
  10.   pHit = 0
  11.   pHitCounter = 0
  12.   pEatCounter = 0
  13.   pGameOver = 0
  14.   sprite(spriteNum).member = "Normal1"
  15. end
  16.  
  17. on mouseUp me
  18.   puppetSound(1, "click bird")
  19.   if pHiding = 1 then
  20.     if (pHit = 0) and (pEating = 0) then
  21.       sprite(spriteNum).member = "Normal1"
  22.       pHiding = 0
  23.     end if
  24.   else
  25.     if (pHit = 0) and (pEating = 0) then
  26.       sprite(spriteNum).member = "Hiding"
  27.       pHiding = 1
  28.     end if
  29.   end if
  30. end
  31.  
  32. on exitFrame me
  33.   if the frame > 15 then
  34.     exit
  35.   end if
  36.   if ((pFrameTimer + 12) < the ticks) and (pHiding = 0) and (pHit = 0) and (pEating = 0) then
  37.     pFrameTimer = the ticks
  38.     pFrameNum = pFrameNum + 1
  39.     if pFrameNum > 2 then
  40.       pFrameNum = 1
  41.     end if
  42.     sprite(spriteNum).member = "Normal" & string(pFrameNum)
  43.   end if
  44.   if (pHit = 0) and (pEating = 0) then
  45.     checkColision(spriteNum)
  46.   end if
  47.   if pHit = 1 then
  48.     monkeyHit()
  49.   end if
  50.   if pEating = 1 then
  51.     monkeyEating()
  52.   end if
  53. end
  54.  
  55. on monkeyHit
  56.   pHitCounter = pHitCounter + 1
  57.   case spriteNum of
  58.     25:
  59.       sprite(45).rotation = sprite(45).rotation + 30
  60.       sprite(46).rotation = sprite(46).rotation + 30
  61.     26:
  62.       sprite(47).rotation = sprite(47).rotation + 30
  63.       sprite(48).rotation = sprite(48).rotation + 30
  64.     27:
  65.       sprite(49).rotation = sprite(49).rotation + 30
  66.       sprite(50).rotation = sprite(50).rotation + 30
  67.   end case
  68.   if pHitCounter > 21 then
  69.     case spriteNum of
  70.       25:
  71.         sprite(45).blend = 0
  72.         sprite(46).blend = 0
  73.       26:
  74.         sprite(47).blend = 0
  75.         sprite(48).blend = 0
  76.       27:
  77.         sprite(49).blend = 0
  78.         sprite(50).blend = 0
  79.     end case
  80.     case spriteNum of
  81.       25:
  82.         repeat with anotherCounter = 200 to 203
  83.           sprite(anotherCounter).blend = 0
  84.         end repeat
  85.       26:
  86.         repeat with anotherCounter = 205 to 208
  87.           sprite(anotherCounter).blend = 0
  88.         end repeat
  89.       27:
  90.         repeat with anotherCounter = 210 to 213
  91.           sprite(anotherCounter).blend = 0
  92.         end repeat
  93.     end case
  94.     sprite(spriteNum + 4).loc = point(800, 800)
  95.     pHit = 0
  96.     sprite(spriteNum).member = "Normal1"
  97.     if gLives < 0 then
  98.       puppetSound(4, "loser")
  99.       go(19)
  100.     end if
  101.   end if
  102. end
  103.  
  104. on monkeyEating
  105.   pEatCounter = pEatCounter + 1
  106.   if pEatCounter > 10 then
  107.     pEating = 0
  108.     sprite(spriteNum).member = "Normal1"
  109.   end if
  110. end
  111.  
  112. on checkColision theSprite
  113.   repeat with counter = 1 to count(gObjectList)
  114.     if sprite(theSprite).intersects(gObjectList[counter].pChannel) and (pHiding = 0) and (gObjectList[counter].pObjectPosition[2] < 364) and (gObjectList[counter].pObjectPosition[2] > 240) then
  115.       if gObjectList[counter].pGoodObject then
  116.         puppetSound(2, "eat worm")
  117.         pEating = 1
  118.         pEatCounter = 0
  119.         sprite(spriteNum).member = "MonkeyEating"
  120.         gScore = gScore + 10
  121.         member("gScore").text = string(gScore)
  122.       else
  123.         puppetSound(2, "hitbirdsound")
  124.         case spriteNum of
  125.           25:
  126.             sprite(45).blend = 100
  127.             sprite(46).blend = 100
  128.           26:
  129.             sprite(47).blend = 100
  130.             sprite(48).blend = 100
  131.           27:
  132.             sprite(49).blend = 100
  133.             sprite(50).blend = 100
  134.         end case
  135.         sprite(spriteNum + 4).loc = sprite(spriteNum).loc
  136.         case spriteNum of
  137.           25:
  138.             repeat with anotherCounter = 200 to 203
  139.               sprite(anotherCounter).blend = 100
  140.             end repeat
  141.           26:
  142.             repeat with anotherCounter = 205 to 208
  143.               sprite(anotherCounter).blend = 100
  144.             end repeat
  145.           27:
  146.             repeat with anotherCounter = 210 to 213
  147.               sprite(anotherCounter).blend = 100
  148.             end repeat
  149.         end case
  150.         pHit = 1
  151.         pHitCounter = 0
  152.         sprite(spriteNum).member = "hitbird"
  153.         gLives = gLives - 1
  154.         if gLives >= 0 then
  155.           member("gLives").text = string(gLives)
  156.         end if
  157.         repeat with counter911 = 200 to 213
  158.           sendSprite(counter911, #reset)
  159.         end repeat
  160.       end if
  161.       gObjectList[counter].killObject()
  162.       deleteAt(gObjectList, counter)
  163.     end if
  164.   end repeat
  165. end
  166.  
  167. on setGameOver
  168.   pGameOver = 0
  169. end
  170.