home *** CD-ROM | disk | FTP | other *** search
- global bgOffset
-
- on initializeTerrain
- global terrainSO, tileSize, prevLocation, playerViewPoint
- terrainSO = 50
- tileSize = point(40, 40)
- wSprite = terrainSO - 1
- repeat with wY = 1 to 12
- repeat with wX = 1 to 10
- wSprite = wSprite + 1
- puppetSprite(wSprite, 1)
- set the loc of sprite wSprite to (point(wX, wY) * tileSize) - (tileSize / 2) + bgOffset
- set the member of sprite wSprite to "big Tile"
- end repeat
- end repeat
- prevLocation = VOID
- playerViewPoint = point(0, 4000)
- end
-
- on initializeMap
- global roadMapData, playerViewPoint
- roadMapData = []
- repeat with wY = 1 to 150
- oneLiner = []
- repeat with wX = 1 to 10
- case wX of
- 1:
- add(oneLiner, 4)
- 2:
- add(oneLiner, 3)
- 4:
- if (wY mod 2) = 0 then
- add(oneLiner, 2)
- else
- add(oneLiner, 1)
- end if
- 7:
- if (wY mod 2) = 0 then
- add(oneLiner, 2)
- else
- add(oneLiner, 1)
- end if
- 9:
- add(oneLiner, 3)
- 10:
- add(oneLiner, 4)
- otherwise:
- add(oneLiner, 1)
- end case
- end repeat
- add(roadMapData, oneLiner)
- end repeat
- end
-
- on initializeplayer
- global playerData, playerSO
- playerData = [0, point(200, 4000), point(0, 0), 100]
- playerSO = 250
- puppetSprite(playerSO, 1)
- set the member of sprite playerSO to "Spy Hunter Car"
- set the loc of sprite playerSO to point(0, 0)
- set the ink of sprite playerSO to 36
- end
-
- on moveplayer
- global playerData, playerSO, playerViewPoint
- mousepos = playerData[2] - playerViewPoint
- moveAim = findAngle(mousepos, the mouseLoc)
- playerData[3] = (the mouseLoc - mousepos) / 30
- pLoc = playerData[2]
- pLoc = pLoc + playerData[3]
- playerData[2] = pLoc
- set the loc of sprite playerSO to playerData[2] - playerViewPoint + bgOffset
- end
-
- on moveterrain
- global terrainSO, tileSize, prevLocation, roadMapData, playerData, playerViewPoint
- displayOffset = playerViewPoint[2] mod tileSize[2]
- tileOffset = playerViewPoint[2] / tileSize[2]
- wSprite = terrainSO - 1
- repeat with wY = 1 to 12
- repeat with wX = 1 to 10
- wSprite = wSprite + 1
- set the loc of sprite wSprite to (point(wX, wY) * tileSize) - (tileSize[2] * 0.5) - point(0, displayOffset) + bgOffset
- tType = roadMapData[wY + tileOffset][wX]
- if prevLocation <> tileOffset then
- prevtType = roadMapData[wY + prevLocation][wX]
- if prevLocation = VOID then
- set the member of sprite wSprite to ["Flat Pavement", "Dotted Single line", "Solid Single line", "Dirt", "Grass"][tType]
- next repeat
- end if
- if tType <> prevtType then
- set the member of sprite wSprite to ["Flat Pavement", "Dotted Single line", "Solid Single line", "Dirt", "Grass"][tType]
- end if
- end if
- end repeat
- end repeat
- if prevLocation <> tileOffset then
- prevLocation = tileOffset
- end if
- end
-