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

  1. global shipData, miniMapDotsSO
  2.  
  3. on initializeMinimap
  4.   global scannerRange, scanMod
  5.   scanMod = 50000
  6.   scannerRange = 1
  7.   anchorLoc = the loc of sprite 480 + point(50, 50)
  8.   repeat with wDot = 1 to count(shipData)
  9.     wSprite = miniMapDotsSO + wDot
  10.     puppetSprite(wSprite, 1)
  11.     set the member of sprite wSprite to "Friendly Dot 1"
  12.     set the loc of sprite wSprite to anchorLoc
  13.     sprite(wSprite).locZ = 781
  14.     set the ink of sprite wSprite to 33
  15.   end repeat
  16. end
  17.  
  18. on updateMiniMap
  19.   global shipData, scannerRange, scanMod, inputString, displaySpriteDepth, prevmap, mapSkip
  20.   if inputString[8] = 1 then
  21.     if (scanMod = 250) or (scanMod = 1000) then
  22.       if scannerRange = 1 then
  23.         scannerRange = 2
  24.       else
  25.         scannerRange = 1
  26.       end if
  27.     end if
  28.   end if
  29.   anchorLoc = the loc of sprite 780 + point(50, 50)
  30.   scanIdeal = [250, 1000, 2500, 10000, 50000][scannerRange]
  31.   repeat with whichScara = 1 to scanMod / 50
  32.     if scanIdeal < scanMod then
  33.       scanMod = scanMod - 10
  34.     else
  35.       if scanIdeal > scanMod then
  36.         scanMod = scanMod + 10
  37.       end if
  38.     end if
  39.     mapSkip = 20
  40.   end repeat
  41.   mapSkip = 20
  42.   if mapSkip >= 20 then
  43.     mapSkip = 0
  44.     prevmap = []
  45.     if scannerRange < 1 then
  46.       scannerRange = 1
  47.     else
  48.       if scannerRange > 5 then
  49.         scannerRange = 5
  50.         bumpMap = 0
  51.       end if
  52.     end if
  53.     dotsPrinted = []
  54.     repeat with wShip = 1 to count(shipData)
  55.       wSprite = miniMapDotsSO + wShip
  56.       if shipData[wShip][1] = 1 then
  57.         pLoc = shipData[1][4][1]
  58.         aLoc = shipData[wShip][4][1]
  59.         finalPixel = (aLoc - pLoc) / scanMod
  60.         shipGov = shipData[wShip][3]
  61.         dotName = VOID
  62.         makeArrow = 0
  63.         if shipGov = 1 then
  64.           case shipData[wShip][2] of
  65.             6:
  66.               dotName = "Friendly Dot 2"
  67.               makeArrow = 1
  68.             otherwise:
  69.               dotName = "Friendly Dot 1"
  70.           end case
  71.         else
  72.           case shipData[wShip][2] of
  73.             7:
  74.               dotName = "Enemy Dot 1"
  75.             otherwise:
  76.               dotName = "Enemy Dot 2"
  77.           end case
  78.         end if
  79.         fineWithMe = 1
  80.         if findDistance(point(0, 0), finalPixel) <= 44 then
  81.           if dotName <> VOID then
  82.             set the member of sprite wSprite to dotName
  83.             set the loc of sprite wSprite to anchorLoc + finalPixel
  84.           else
  85.             set the loc of sprite wSprite to point(-50, -50)
  86.           end if
  87.         else
  88.           if makeArrow = 1 then
  89.             homeAngle = findAngle(point(0, 0), finalPixel)
  90.             locY = integer(cos(homeAngle * PI / 180) * -40)
  91.             locX = integer(sin(homeAngle * PI / 180) * 40)
  92.             set the loc of sprite wSprite to anchorLoc + point(locX, locY)
  93.             set the member of sprite wSprite to "Homebase Arrow"
  94.             sprite(wSprite).rotation = homeAngle
  95.           else
  96.             set the loc of sprite wSprite to point(-50, -50)
  97.           end if
  98.         end if
  99.         next repeat
  100.       end if
  101.       set the loc of sprite wSprite to point(-50, -50)
  102.     end repeat
  103.     member("Active Map").setPixel(25, 25, 225)
  104.   else
  105.     mapSkip = mapSkip + 1
  106.   end if
  107. end
  108.