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

  1. on exitFrame me
  2.   global grabbedPiece, pegData, holeData, inputString, gottaRedraw, tickRecord, levelTimer, unfinishedSlots, timeRecount, panicTimer, homeLocations, victoryDelay
  3.   harvestInput()
  4.   speedmod = 1
  5.   if the ticks > tickRecord then
  6.     totalTicksLeft = integer((3600 * speedmod * 2) - levelTimer)
  7.     timerSeconds = (totalTicksLeft / 60 mod 60) + 1
  8.     timerMinutes = totalTicksLeft / 60 / 60
  9.     if timerSeconds = 60 then
  10.       timerSeconds = 0
  11.       timerMinutes = timerMinutes + 1
  12.     end if
  13.     if timerSeconds < 10 then
  14.       member("Timer Display").text = string(timerMinutes) & ":0" & string(timerSeconds)
  15.     else
  16.       member("Timer Display").text = string(timerMinutes) & ":" & string(timerSeconds)
  17.     end if
  18.     totalSeconds = (totalTicksLeft / 60) + 1
  19.     if integer(totalSeconds) < integer(panicTimer) then
  20.       panicTimer = integer(totalSeconds)
  21.       member("Panic Counter").text = string(panicTimer)
  22.       sprite(16).visible = 1
  23.     end if
  24.     tickRecord = the ticks + 0.5
  25.     if gottaRedraw = 1 then
  26.       drawSlots(1)
  27.       gottaRedraw = 0
  28.     else
  29.       drawSlots(0)
  30.     end if
  31.     levelTimer = levelTimer + 1
  32.     repeat with wPiece = 1 to count(pegData)
  33.       if (wPiece <> grabbedPiece) and (pegData[wPiece][4] = 0) then
  34.         if homeLocations[wPiece] <> pegData[wPiece][1] then
  35.           moveAim = findAngle(pegData[wPiece][1], homeLocations[wPiece])
  36.           moveDist = findDistance(pegData[wPiece][1], homeLocations[wPiece])
  37.           if moveDist <= 10 then
  38.             pegData[wPiece][1] = homeLocations[wPiece]
  39.           else
  40.             locY = integer(cos(moveAim * PI / 180) * -20)
  41.             locX = integer(sin(moveAim * PI / 180) * 20)
  42.             pegData[wPiece][1] = pegData[wPiece][1] + point(locX, locY)
  43.           end if
  44.           set the loc of sprite (100 + wPiece) to pegData[wPiece][1]
  45.         end if
  46.       end if
  47.     end repeat
  48.     if levelTimer > (60 * 60 * speedmod) then
  49.       levelTimer = 60 * 60 * speedmod
  50.     end if
  51.     set the member of sprite integer(200 + (levelTimer / 60.0 / speedmod) - 0.5) to "Red Bulb"
  52.     timeAimer = levelTimer / 10.0 / speedmod
  53.     locY = integer(cos(timeAimer * PI / 180) * -210)
  54.     locX = integer(sin(timeAimer * PI / 180) * 210)
  55.     set the loc of sprite 261 to the loc of sprite 5 + point(locX, locY - 2)
  56.     sprite(261).locZ = 16
  57.     if grabbedPiece <> 0 then
  58.       pegData[grabbedPiece][1] = the mouseLoc
  59.       if inputString[1] = 1 then
  60.         pegData[grabbedPiece][2] = pegData[grabbedPiece][2] - 10
  61.       else
  62.         if inputString[2] = 1 then
  63.           pegData[grabbedPiece][2] = pegData[grabbedPiece][2] + 10
  64.         end if
  65.       end if
  66.       coreloc = pegData[grabbedPiece][2]
  67.     end if
  68.     timeRecount = timeRecount = 1
  69.     if timeRecount > 10 then
  70.       drawpegs()
  71.       timeRecount = 0
  72.     end if
  73.     updatePeg()
  74.   end if
  75.   if unfinishedSlots > 0 then
  76.     if levelTimer >= 3600 then
  77.       go(35)
  78.     else
  79.       go(the frame)
  80.     end if
  81.   else
  82.     updateStage()
  83.     victoryDelay = 0
  84.     go(15)
  85.   end if
  86. end
  87.