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

  1. on exitFrame me
  2.   global pathIndex, tileSO, tileSize, moveType, boardData, moveTestPositions, moveTestResults, whichLevel, attackSoundRegistered, CPUdelay, mustGiveUp
  3.   tileLocPointer = the mouseLoc - the loc of sprite tileSO
  4.   tileLocPointer = (tileLocPointer / tileSize) + point(1, 1)
  5.   if keyPressed(49) = 1 then
  6.     if count(pathIndex) > 1 then
  7.       executePlayerMoves()
  8.       pathIndex = []
  9.       moveType = VOID
  10.       CPUdelay = 0
  11.       go(15)
  12.     end if
  13.     if attackSoundRegistered = 1 then
  14.       playSound("Jump Piece SFX", 1)
  15.     else
  16.       playSound("Player Move SFX", 1)
  17.     end if
  18.   end if
  19.   drawPathArrows()
  20.   redrawBoard()
  21.   results = checkGameComplete()
  22.   if calculateAllMoves(2, 1) = 1 then
  23.     go(25)
  24.   else
  25.     if (results[1] = 0) or (calculateAllMoves(1, 1) = 1) then
  26.       if whichLevel < 5 then
  27.         go(20)
  28.       else
  29.         go(30)
  30.       end if
  31.     else
  32.       if results[2] = 0 then
  33.         go(25)
  34.       end if
  35.     end if
  36.   end if
  37.   go(the frame)
  38. end
  39.  
  40. on mouseDown
  41.   global pathIndex, tileSO, tileSize, boardData, moveTestResults, moveTestPositions, moveType
  42.   tileLocPointer = the mouseLoc - the loc of sprite tileSO
  43.   tileLocPointer = (tileLocPointer / tileSize) + 1
  44.   if (tileLocPointer[1] < 1) or (tileLocPointer[1] > count(boardData)) then
  45.     pathIndex = []
  46.     moveType = VOID
  47.   else
  48.     if (tileLocPointer[2] < 1) or (tileLocPointer[2] > count(boardData)) then
  49.       pathIndex = []
  50.       moveType = VOID
  51.     else
  52.       selfPiece = 0
  53.       if boardData[tileLocPointer[2]][tileLocPointer[1]] = #Bp then
  54.         selfPiece = 1
  55.       end if
  56.       if boardData[tileLocPointer[2]][tileLocPointer[1]] = #Bk then
  57.         selfPiece = 1
  58.       end if
  59.       if count(pathIndex) = 0 then
  60.         pType = boardData[tileLocPointer[2]][tileLocPointer[1]]
  61.         if (pType = #Bp) or (pType = #Bk) then
  62.           add(pathIndex, tileLocPointer)
  63.           testJumps(tileLocPointer)
  64.         end if
  65.       else
  66.         if selfPiece = 1 then
  67.           pathIndex = []
  68.           moveType = VOID
  69.           pType = boardData[tileLocPointer[2]][tileLocPointer[1]]
  70.           if (pType = #Bp) or (pType = #Bk) then
  71.             add(pathIndex, tileLocPointer)
  72.             testJumps(tileLocPointer)
  73.           end if
  74.           repeat with whichX = 1 to 10
  75.             set the loc of sprite (200 + whichX) to point(-500, -500)
  76.             set the height of sprite (200 + whichX) to 1
  77.           end repeat
  78.         else
  79.           pLoc = pathIndex[count(pathIndex)]
  80.           pType = boardData[tileLocPointer[2]][tileLocPointer[1]]
  81.           testJumps(pLoc, returnPiece(pathIndex[1]))
  82.           validMove = 0
  83.           repeat with whichV = 1 to count(moveTestPositions)
  84.             if moveTestPositions[whichV] = tileLocPointer then
  85.               validMove = 1
  86.               if moveType = VOID then
  87.                 moveType = moveTestResults[whichV]
  88.                 next repeat
  89.               end if
  90.               if (moveType = #Attack) and (moveTestResults[whichV] <> #Attack) then
  91.                 validMove = 0
  92.               end if
  93.             end if
  94.           end repeat
  95.           if validMove = 1 then
  96.             add(pathIndex, tileLocPointer)
  97.           end if
  98.         end if
  99.       end if
  100.     end if
  101.   end if
  102. end
  103.