home *** CD-ROM | disk | FTP | other *** search
- on exitFrame me
- global pathIndex, tileSO, tileSize, moveType, boardData, moveTestPositions, moveTestResults, whichLevel, attackSoundRegistered, CPUdelay, mustGiveUp
- tileLocPointer = the mouseLoc - the loc of sprite tileSO
- tileLocPointer = (tileLocPointer / tileSize) + point(1, 1)
- if keyPressed(49) = 1 then
- if count(pathIndex) > 1 then
- executePlayerMoves()
- pathIndex = []
- moveType = VOID
- CPUdelay = 0
- go(15)
- end if
- if attackSoundRegistered = 1 then
- playSound("Jump Piece SFX", 1)
- else
- playSound("Player Move SFX", 1)
- end if
- end if
- drawPathArrows()
- redrawBoard()
- results = checkGameComplete()
- if calculateAllMoves(2, 1) = 1 then
- go(25)
- else
- if (results[1] = 0) or (calculateAllMoves(1, 1) = 1) then
- if whichLevel < 5 then
- go(20)
- else
- go(30)
- end if
- else
- if results[2] = 0 then
- go(25)
- end if
- end if
- end if
- go(the frame)
- end
-
- on mouseDown
- global pathIndex, tileSO, tileSize, boardData, moveTestResults, moveTestPositions, moveType
- tileLocPointer = the mouseLoc - the loc of sprite tileSO
- tileLocPointer = (tileLocPointer / tileSize) + 1
- if (tileLocPointer[1] < 1) or (tileLocPointer[1] > count(boardData)) then
- pathIndex = []
- moveType = VOID
- else
- if (tileLocPointer[2] < 1) or (tileLocPointer[2] > count(boardData)) then
- pathIndex = []
- moveType = VOID
- else
- selfPiece = 0
- if boardData[tileLocPointer[2]][tileLocPointer[1]] = #Bp then
- selfPiece = 1
- end if
- if boardData[tileLocPointer[2]][tileLocPointer[1]] = #Bk then
- selfPiece = 1
- end if
- if count(pathIndex) = 0 then
- pType = boardData[tileLocPointer[2]][tileLocPointer[1]]
- if (pType = #Bp) or (pType = #Bk) then
- add(pathIndex, tileLocPointer)
- testJumps(tileLocPointer)
- end if
- else
- if selfPiece = 1 then
- pathIndex = []
- moveType = VOID
- pType = boardData[tileLocPointer[2]][tileLocPointer[1]]
- if (pType = #Bp) or (pType = #Bk) then
- add(pathIndex, tileLocPointer)
- testJumps(tileLocPointer)
- end if
- repeat with whichX = 1 to 10
- set the loc of sprite (200 + whichX) to point(-500, -500)
- set the height of sprite (200 + whichX) to 1
- end repeat
- else
- pLoc = pathIndex[count(pathIndex)]
- pType = boardData[tileLocPointer[2]][tileLocPointer[1]]
- testJumps(pLoc, returnPiece(pathIndex[1]))
- validMove = 0
- repeat with whichV = 1 to count(moveTestPositions)
- if moveTestPositions[whichV] = tileLocPointer then
- validMove = 1
- if moveType = VOID then
- moveType = moveTestResults[whichV]
- next repeat
- end if
- if (moveType = #Attack) and (moveTestResults[whichV] <> #Attack) then
- validMove = 0
- end if
- end if
- end repeat
- if validMove = 1 then
- add(pathIndex, tileLocPointer)
- end if
- end if
- end if
- end if
- end if
- end
-