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

  1. on exitFrame me
  2.   global pathIndex, tileSO, tileSize, moveType, boardData, moveTestPositions, moveTestResults
  3.   tileLocPointer = the mouseLoc - the loc of sprite tileSO
  4.   tileLocPointer = (tileLocPointer / tileSize) + point(1, 1)
  5.   if keyPressed(49) = 1 then
  6.     pathIndex = []
  7.     moveType = VOID
  8.   end if
  9.   if count(pathIndex) > 1 then
  10.     if moveType = #move then
  11.       pType = boardData[pathIndex[1][2]][pathIndex[1][1]]
  12.       boardData[pathIndex[1][2]][pathIndex[1][1]] = [0, 0]
  13.       boardData[pathIndex[2][2]][pathIndex[2][1]] = pType
  14.       pathIndex = []
  15.       moveType = VOID
  16.     end if
  17.   end if
  18.   repeat with whichpath = 1 to 8
  19.     wSprite = 200 + whichpath
  20.     if whichpath < count(pathIndex) then
  21.       set the loc of sprite wSprite to (pathIndex[whichpath] * tileSize) + the loc of sprite tileSO - (tileSize / 2)
  22.       theAngle = findAngle(pathIndex[whichpath], pathIndex[whichpath + 1])
  23.       theDist = findDistance(pathIndex[whichpath] * tileSize, pathIndex[whichpath + 1] * tileSize)
  24.       sprite(wSprite).rotation = theAngle
  25.       set the width of sprite wSprite to 15
  26.       set the height of sprite wSprite to theDist
  27.       set the member of sprite wSprite to "Arrow"
  28.       next repeat
  29.     end if
  30.     if whichpath = count(pathIndex) then
  31.       validMove = 0
  32.       repeat with whichV = 1 to count(moveTestPositions)
  33.         if moveTestPositions[whichV] = tileLocPointer then
  34.           validMove = 1
  35.           if moveType = VOID then
  36.             moveType = moveTestResults[whichV]
  37.           end if
  38.         end if
  39.       end repeat
  40.       theAngle = findAngle(pathIndex[whichpath], tileLocPointer)
  41.       theDist = findDistance(pathIndex[whichpath] * tileSize, tileLocPointer * tileSize)
  42.       next repeat
  43.     end if
  44.     set the loc of sprite wSprite to point(-50, -50)
  45.     sprite(wSprite).rotation = 0
  46.     set the height of sprite wSprite to 5
  47.     set the width of sprite wSprite to 15
  48.   end repeat
  49.   redrawBoard()
  50.   go(the frame)
  51. end
  52.  
  53. on mouseDown
  54.   global pathIndex, tileSO, tileSize, boardData, moveTestResults, moveTestPositions, moveType
  55.   tileLocPointer = the mouseLoc - the loc of sprite tileSO
  56.   tileLocPointer = (tileLocPointer / tileSize) + 1
  57.   if count(pathIndex) = 0 then
  58.     pType = boardData[tileLocPointer[2]][tileLocPointer[1]]
  59.     if pType = #Bp then
  60.       add(pathIndex, tileLocPointer)
  61.       testJumps(tileLocPointer)
  62.     end if
  63.   else
  64.     testJumps(pathIndex[count(pathIndex)])
  65.     validMove = 0
  66.     repeat with whichV = 1 to count(moveTestPositions)
  67.       if moveTestPositions[whichV] = tileLocPointer then
  68.         validMove = 1
  69.         if moveType = VOID then
  70.           moveType = moveTestResults[whichV]
  71.         end if
  72.       end if
  73.     end repeat
  74.     if validMove = 1 then
  75.       add(pathIndex, tileLocPointer)
  76.     end if
  77.   end if
  78. end
  79.