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

  1. global bgOffset
  2.  
  3. on initializeTerrain
  4.   global terrainSO, tileSize, prevLocation, playerViewPoint
  5.   terrainSO = 50
  6.   tileSize = point(40, 40)
  7.   wSprite = terrainSO - 1
  8.   repeat with wY = 1 to 12
  9.     repeat with wX = 1 to 10
  10.       wSprite = wSprite + 1
  11.       puppetSprite(wSprite, 1)
  12.       set the loc of sprite wSprite to (point(wX, wY) * tileSize) - (tileSize / 2) + bgOffset
  13.       set the member of sprite wSprite to "big Tile"
  14.     end repeat
  15.   end repeat
  16.   prevLocation = VOID
  17.   playerViewPoint = point(0, 4000)
  18. end
  19.  
  20. on initializeMap
  21.   global roadMapData, playerViewPoint
  22.   roadMapData = []
  23.   repeat with wY = 1 to 150
  24.     oneLiner = []
  25.     repeat with wX = 1 to 10
  26.       case wX of
  27.         1:
  28.           add(oneLiner, 4)
  29.         2:
  30.           add(oneLiner, 3)
  31.         4:
  32.           if (wY mod 2) = 0 then
  33.             add(oneLiner, 2)
  34.           else
  35.             add(oneLiner, 1)
  36.           end if
  37.         7:
  38.           if (wY mod 2) = 0 then
  39.             add(oneLiner, 2)
  40.           else
  41.             add(oneLiner, 1)
  42.           end if
  43.         9:
  44.           add(oneLiner, 3)
  45.         10:
  46.           add(oneLiner, 4)
  47.         otherwise:
  48.           add(oneLiner, 1)
  49.       end case
  50.     end repeat
  51.     add(roadMapData, oneLiner)
  52.   end repeat
  53. end
  54.  
  55. on initializeplayer
  56.   global playerData, playerSO
  57.   playerData = [0, point(200, 4000), point(0, 0), 100]
  58.   playerSO = 250
  59.   puppetSprite(playerSO, 1)
  60.   set the member of sprite playerSO to "Spy Hunter Car"
  61.   set the loc of sprite playerSO to point(0, 0)
  62.   set the ink of sprite playerSO to 36
  63. end
  64.  
  65. on moveplayer
  66.   global playerData, playerSO, playerViewPoint
  67.   mousepos = playerData[2] - playerViewPoint
  68.   moveAim = findAngle(mousepos, the mouseLoc)
  69.   playerData[3] = (the mouseLoc - mousepos) / 30
  70.   pLoc = playerData[2]
  71.   pLoc = pLoc + playerData[3]
  72.   playerData[2] = pLoc
  73.   set the loc of sprite playerSO to playerData[2] - playerViewPoint + bgOffset
  74. end
  75.  
  76. on moveterrain
  77.   global terrainSO, tileSize, prevLocation, roadMapData, playerData, playerViewPoint
  78.   displayOffset = playerViewPoint[2] mod tileSize[2]
  79.   tileOffset = playerViewPoint[2] / tileSize[2]
  80.   wSprite = terrainSO - 1
  81.   repeat with wY = 1 to 12
  82.     repeat with wX = 1 to 10
  83.       wSprite = wSprite + 1
  84.       set the loc of sprite wSprite to (point(wX, wY) * tileSize) - (tileSize[2] * 0.5) - point(0, displayOffset) + bgOffset
  85.       tType = roadMapData[wY + tileOffset][wX]
  86.       if prevLocation <> tileOffset then
  87.         prevtType = roadMapData[wY + prevLocation][wX]
  88.         if prevLocation = VOID then
  89.           set the member of sprite wSprite to ["Flat Pavement", "Dotted Single line", "Solid Single line", "Dirt", "Grass"][tType]
  90.           next repeat
  91.         end if
  92.         if tType <> prevtType then
  93.           set the member of sprite wSprite to ["Flat Pavement", "Dotted Single line", "Solid Single line", "Dirt", "Grass"][tType]
  94.         end if
  95.       end if
  96.     end repeat
  97.   end repeat
  98.   if prevLocation <> tileOffset then
  99.     prevLocation = tileOffset
  100.   end if
  101. end
  102.