home *** CD-ROM | disk | FTP | other *** search
- on exitFrame me
- global pathIndex, tileSO, tileSize, moveType, boardData, moveTestPositions, moveTestResults
- tileLocPointer = the mouseLoc - the loc of sprite tileSO
- tileLocPointer = (tileLocPointer / tileSize) + point(1, 1)
- if keyPressed(49) = 1 then
- pathIndex = []
- moveType = VOID
- end if
- if count(pathIndex) > 1 then
- if moveType = #move then
- pType = boardData[pathIndex[1][2]][pathIndex[1][1]]
- boardData[pathIndex[1][2]][pathIndex[1][1]] = [0, 0]
- boardData[pathIndex[2][2]][pathIndex[2][1]] = pType
- pathIndex = []
- moveType = VOID
- end if
- end if
- repeat with whichpath = 1 to 8
- wSprite = 200 + whichpath
- if whichpath < count(pathIndex) then
- set the loc of sprite wSprite to (pathIndex[whichpath] * tileSize) + the loc of sprite tileSO - (tileSize / 2)
- theAngle = findAngle(pathIndex[whichpath], pathIndex[whichpath + 1])
- theDist = findDistance(pathIndex[whichpath] * tileSize, pathIndex[whichpath + 1] * tileSize)
- sprite(wSprite).rotation = theAngle
- set the width of sprite wSprite to 15
- set the height of sprite wSprite to theDist
- set the member of sprite wSprite to "Arrow"
- next repeat
- end if
- if whichpath = count(pathIndex) then
- validMove = 0
- repeat with whichV = 1 to count(moveTestPositions)
- if moveTestPositions[whichV] = tileLocPointer then
- validMove = 1
- if moveType = VOID then
- moveType = moveTestResults[whichV]
- end if
- end if
- end repeat
- theAngle = findAngle(pathIndex[whichpath], tileLocPointer)
- theDist = findDistance(pathIndex[whichpath] * tileSize, tileLocPointer * tileSize)
- next repeat
- end if
- set the loc of sprite wSprite to point(-50, -50)
- sprite(wSprite).rotation = 0
- set the height of sprite wSprite to 5
- set the width of sprite wSprite to 15
- end repeat
- redrawBoard()
- 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 count(pathIndex) = 0 then
- pType = boardData[tileLocPointer[2]][tileLocPointer[1]]
- if pType = #Bp then
- add(pathIndex, tileLocPointer)
- testJumps(tileLocPointer)
- end if
- else
- testJumps(pathIndex[count(pathIndex)])
- validMove = 0
- repeat with whichV = 1 to count(moveTestPositions)
- if moveTestPositions[whichV] = tileLocPointer then
- validMove = 1
- if moveType = VOID then
- moveType = moveTestResults[whichV]
- end if
- end if
- end repeat
- if validMove = 1 then
- add(pathIndex, tileLocPointer)
- end if
- end if
- end
-