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

  1. property pTimer
  2. global gObjectList, gLives, gScore
  3.  
  4. on new
  5.   gObjectList = []
  6.   pTimer = the ticks
  7.   sendSprite(27, #setGameOver)
  8.   sendSprite(28, #setGameOver)
  9.   sendSprite(29, #setGameOver)
  10. end
  11.  
  12. on exitFrame me
  13.   objectDropSpeed = 90 - (gScore / 30)
  14.   if objectDropSpeed < 45 then
  15.     objectDropSpeed = 45
  16.   end if
  17.   if ((pTimer + objectDropSpeed) < the ticks) and (random(2) = 1) then
  18.     pTimer = the ticks
  19.     aChannel = 100
  20.     found = 0
  21.     repeat while found = 0
  22.       if sprite(aChannel).puppet = 1 then
  23.         aChannel = aChannel + 1
  24.         next repeat
  25.       end if
  26.       found = 1
  27.     end repeat
  28.     theSpeed = 3 + (gScore / 300)
  29.     if theSpeed > 15 then
  30.       theSpeed = 15
  31.     end if
  32.     if random(5) = 1 then
  33.       append(gObjectList, new(script("Object"), point(sprite(random(3) + 24).locH, -10), theSpeed, 0, "poison", aChannel))
  34.     else
  35.       append(gObjectList, new(script("Object"), point(sprite(random(3) + 24).locH, -10), theSpeed, 1, "Fruit", aChannel))
  36.     end if
  37.   end if
  38.   repeat with counter = 1 to count(gObjectList)
  39.     gObjectList[counter].updateObject()
  40.   end repeat
  41.   checkIfObjectsAreGone()
  42.   go(the frame)
  43. end
  44.  
  45. on checkIfObjectsAreGone
  46.   repeat with counter = 1 to count(gObjectList)
  47.     if gObjectList[counter].pObjectPosition[2] > 470 then
  48.       if gObjectList[counter].pGoodObject then
  49.         gLives = gLives - 1
  50.         puppetSound(6, "wrongguess")
  51.         if gLives < 0 then
  52.           puppetSound(4, "loser")
  53.           go(19)
  54.           exit
  55.         end if
  56.         member("gLives").text = string(gLives)
  57.       end if
  58.       gObjectList[counter].killObject()
  59.       deleteAt(gObjectList, counter)
  60.     end if
  61.   end repeat
  62. end
  63.