home *** CD-ROM | disk | FTP | other *** search
- on redrawBoard
- global boardData, tileSO, tileSize, pathIndex
- wSprite = tileSO
- repeat with whichY = 1 to count(boardData)
- repeat with whichX = 1 to count(boardData[1])
- wSprite = wSprite + 1
- tBit = boardData[whichY][whichX]
- if count(pathIndex) > 0 then
- if pathIndex[1] = point(whichX, whichY) then
- affix = " Lit"
- else
- affix = " Dark"
- end if
- else
- affix = " Dark"
- end if
- case tBit of
- #Na:
- sprite(wSprite).visible = 0
- #Rp:
- set the member of sprite wSprite to "Red Piece" & affix
- sprite(wSprite).visible = 1
- #Bp:
- set the member of sprite wSprite to "Black Piece" & affix
- sprite(wSprite).visible = 1
- #Rk:
- set the member of sprite wSprite to "Red King" & affix
- sprite(wSprite).visible = 1
- #Bk:
- set the member of sprite wSprite to "Black King" & affix
- sprite(wSprite).visible = 1
- otherwise:
- sprite(wSprite).visible = 0
- end case
- pLoc = point(whichX * tileSize, whichY * tileSize) + the loc of sprite tileSO - (tileSize / 2)
- set the loc of sprite wSprite to pLoc
- set the ink of sprite wSprite to 31
- end repeat
- end repeat
- end
-
- on initializeBoard
- global boardData, tileSO, tileSize, totalpieces
- squareTiles = 10
- tileSize = the width of sprite tileSO / squareTiles
- wSprite = tileSO
- boardData = []
- repeat with whichY = 1 to squareTiles
- oneLiner = []
- repeat with whichX = 1 to squareTiles
- wSprite = wSprite + 1
- puppetSprite(wSprite, 1)
- case 1 of
- 1:
- if ((whichY + whichX) mod 2) = 0 then
- if whichY <= 2 then
- tBit = #Rp
- else
- if whichY >= 9 then
- tBit = #Bp
- else
- tBit = #Na
- end if
- end if
- else
- tBit = #Na
- end if
- 2:
- tBit = [#Bp, #Rp, #Na, #Na][random(4)]
- 3:
- tBit = #Na
- end case
- add(oneLiner, tBit)
- case tBit of
- #Na:
- sprite(wSprite).visible = 0
- #Rp:
- set the member of sprite wSprite to "red Piece"
- sprite(wSprite).visible = 1
- #Bp:
- set the member of sprite wSprite to "Black Piece"
- sprite(wSprite).visible = 1
- end case
- pLoc = point(whichX * tileSize, whichY * tileSize) + the loc of sprite tileSO - (tileSize / 2)
- set the loc of sprite wSprite to pLoc
- set the ink of sprite wSprite to 31
- end repeat
- add(boardData, oneLiner)
- end repeat
- totalpieces = 0
- repeat with whichX = 1 to count(boardData)
- repeat with whichY = 1 to count(boardData)
- if boardData[whichY][whichX] = #Bp then
- totalpieces = totalpieces + 1
- end if
- end repeat
- end repeat
- end
-