home *** CD-ROM | disk | FTP | other *** search
/ A Field Trip to the Sky (Demo) / Mac_Sunburst_AFieldTripToTheSky-Demo.iso / DIR / GAME.DIR / 00102_Script_animate-setPlanet < prev    next >
Text File  |  1996-03-27  |  8KB  |  255 lines

  1. global gSkyColorList, gSkyColor
  2. global gDistList, gDist
  3. global gDayLengthList, gDayLength
  4. global gMagList, gMag
  5. global gWeightList, gWeight
  6. global gTempList, gTemp
  7. global gMoons, gMoonsClicked, gRingsClicked
  8. global gElementClicked
  9. global gAttrList, gChoosing
  10.  
  11.  
  12. -- ïï doAnimate ïï
  13. on doAnimate
  14.   global gTellGameToRestore
  15.   
  16.   --if soundBusy(2) then exit
  17.   
  18.   if gTellGameToRestore then gameRestorePuppets()
  19.   
  20.   
  21.   if(gChoosing = FALSE ) then
  22.     -- check skycolor
  23.     if( gSkyColor > 0 AND gSkyColor <= count(gSkyColorList)) then
  24.       set s to 12
  25.       puppetSprite(s,TRUE)
  26.       set the locH of sprite s to getAt(gSkyColorList,gSkyColor)
  27.       
  28.       set gSkyColor to gSkyColor + 1
  29.     end if
  30.     
  31.     -- check distance from sun
  32.     if( gDist > 0 ) then
  33.       --put "doAnimate: distcast = ", gDist, getAt(gDistList,gDist)
  34.       set s to 15
  35.       puppetSprite(s,TRUE)
  36.       set the castNum of sprite s to getAt(gDistList,gDist)
  37.       
  38.       set gDist to gDist + 1
  39.       if( gDist > count(gDistList) ) then set gDist to gDist - 7
  40.     end if
  41.     
  42.     -- check day length
  43.     if( gDayLength > 0 ) then
  44.       --put "doAnimate: DayLengthcast = ", gDayLength, getAt(gDayLengthList,gDayLength)
  45.       set s to 13
  46.       puppetSprite(s,TRUE)
  47.       set the castNum of sprite s to getAt(gDayLengthList,gDayLength)
  48.       
  49.       set gDayLength to gDayLength + 1
  50.       if( gDayLength > count(gDayLengthList) ) then set gDayLength to gDayLength - 7
  51.     end if
  52.     
  53.     -- check weight
  54.     if( gWeight > 0 ) then
  55.       set s to 14
  56.       puppetSprite(s,TRUE)
  57.       set the locV of sprite s to getAt(gWeightList,gWeight)
  58.       
  59.       set gWeight to gWeight + 1
  60.       if( gWeight > count(gWeightList) ) then set gWeight to count(gWeightList) - 5
  61.     end if
  62.     
  63.     -- check temp
  64.     if( gTemp > 0 ) then
  65.       set s to 9
  66.       puppetSprite(s,TRUE)
  67.       set the loch of sprite s to getAt(gTempList,gTemp)
  68.       
  69.       set gTemp to gTemp + 1
  70.       if gTemp > count(gTempList) then set gTemp to gTemp - 6
  71.     end if
  72.     
  73.     -- check magnetic field
  74.     if( gMag > 0 ) then
  75.       set s to 7
  76.       puppetSprite(s,TRUE)
  77.       set the castNum of sprite s to getAt(gMagList,gMag)
  78.       
  79.       set gMag to gMag + 1
  80.       if( gMag > count(gMagList) ) then set gMag to gMag - 6
  81.     end if
  82.     
  83.     -- check moons
  84.     if gMoons <> 0 then
  85.       
  86.       set s to 16
  87.       set gMoons to random(9)
  88.       set the castNum of sprite s to ((the number of cast "1 Moon") + gMoons-1)
  89.       
  90.     end if
  91.     
  92.     -- check the static
  93.     set s to 8
  94.     
  95.     if the castNum of sprite s <> 0 AND the frame < 15 then
  96.       if the name of cast the castNum of sprite s contains "static"  then
  97.         puppetSprite s, TRUE
  98.         set n to value(word 2 of the name of cast (the castNum of sprite s))
  99.         set the castNum of sprite s to the number of cast ("Static" && string(n mod 2 + 1))
  100.       end if
  101.       
  102.     end if
  103.     
  104.     -- and tell everybody to redraw
  105.     updateStage
  106.     
  107.   end if
  108.   
  109. end
  110.  
  111.  
  112. -- ïï setPlanet ïï
  113. -- set up which planet we're looking at
  114. on setPlanet
  115.   
  116.   -- pick a planet
  117.   set p to random(9)
  118.   
  119.   -- set up the attributes
  120.   if( p = 1 ) then
  121.     -- mercury
  122.     set theList to [-200,200]
  123.     set theTemp to getAt( theList, random(2))
  124.     set gAttrList to [#name:"mercury",#distance:0, #skycolor:"black", #daylength:40, ¬
  125. #surfacetemp:theTemp, #gravity:-1, #magfield:0,#rings:0,#moons:0,#h:0, #n:0,#CH4:0,#CO2:0]
  126.   else if( p = 2 ) then
  127.     -- venus
  128.     set gAttrList to [#name:"venus", #distance:0, #skycolor:"yellow", #daylength:40, ¬
  129. #surfacetemp:200, #gravity:0, #magfield:0,#rings:0,#moons:0,#h:0, #n:1,#CH4:0,#CO2:1]
  130.   else if( p = 3 ) then
  131.     -- moon
  132.     set gAttrList to [#name:"moon", #distance:0, #skycolor:"black", #daylength:40, ¬
  133. #surfacetemp:0, #gravity:-1, #magfield:0,#rings:0,#moons:0,#h:0, #n:0,#CH4:0,#CO2:0]
  134.   else if( p = 4 ) then
  135.     -- mars
  136.     set theList to ["Mars 1", "mars 2"]
  137.     set theMoon to the number of cast getAt( theList, random(count(theList)))
  138.     set gAttrList to [#name:"mars",#distance:100, #skycolor:"red", #daylength:22, #surfacetemp:0, ¬
  139. #gravity:-1, #magfield:0,#rings:0,#moons:1,#moonNum:theMoon,#h:0, #n:1,#CH4:0,#CO2:1]
  140.   else if( p = 5 ) then
  141.     -- jupiter
  142.     set theList to ["red", "orange", "yellow"]
  143.     set theColor to getAt( theList, random(3))
  144.     set theMoon to the number of cast "Io (Jupiter)"
  145.     set gAttrList to [#name:"jupiter",#distance:100, #skycolor:theColor, #daylength:0, ¬
  146. #surfacetemp:-200, #gravity:1, #magfield:2,#rings:1,#moons:10,#moonNum:theMoon, ¬
  147. #h:1, #n:0,#CH4:1,#CO2:0]
  148.   else if( p = 6 ) then
  149.     -- saturn
  150.     set theList to ["orange", "yellow"]
  151.     set theColor to getAt( theList, random(2))
  152.     set theList to ["Saturn 1", "Titan (Saturn)", "Mimas (Saturn)"]
  153.     set theMoon to the number of cast getAt( theList, random(count(theList)))
  154.     set gAttrList to [#name:"saturn",#distance:100, #skycolor:theColor, #daylength:0, ¬
  155.  #surfacetemp:-200, #gravity:0, #magfield:1,#rings:1,#moons:10,#moonNum:theMoon, ¬
  156. #h:1, #n:0,#CH4:0,#CO2:0]
  157.   else if( p = 7 ) then
  158.     -- uranus
  159.     set theList to ["Umbriel (Uranus)", "Titania (Uranus)", "Oberon (Uranus)"]
  160.     set theMoon to the number of cast getAt( theList, random(count(theList)))
  161.     set gAttrList to [#name:"uranus",#distance:1000, #skycolor:"blue", #daylength:0, ¬
  162. #surfacetemp:-200,#gravity:0, #magfield:1,#rings:1,#moons:10,#moonNum:theMoon, ¬
  163. #h:1, #n:0,#CH4:1,#CO2:0]
  164.   else if( p = 8 ) then
  165.     -- neptune
  166.     set theMoon to the number of cast "Triton (Neptune)"
  167.     set gAttrList to [#name:"neptune",#distance:1000, #skycolor:"blue", #daylength:0, ¬
  168. #surfacetemp:-200, #gravity:0, #magfield:1,#rings:1,#moons:1,#moonNum:theMoon, ¬
  169. #h:1, #n:0,#CH4:1,#CO2:0]
  170.   else if( p = 9 ) then
  171.     -- pluto
  172.     set theMoon to the number of cast "Charon (Pluto)"
  173.     set gAttrList to [#name:"pluto",#distance:1000, #skycolor:"black", #daylength:40, ¬
  174. #surfacetemp:-200,#gravity:-1, #magfield:0,#rings:0,#moons:1,#moonNum:theMoon, ¬
  175. #h:0, #n:1,#CH4:1,#CO2:0]
  176.   end if
  177.   
  178.   -- add in the planet num
  179.   addProp(gAttrList,#planet,p)
  180.   
  181.   set gSkyColorList to []
  182.   set gSkyColor to 0
  183.   
  184.   set gDistList to []
  185.   set gDist to 0
  186.   
  187.   set gDayLengthList to []
  188.   set gDayLength to 0
  189.   
  190.   set gMagList to []
  191.   set gMag to 0
  192.   
  193.   set gWeightList to []
  194.   set gWeight to 0
  195.   
  196.   set gTempList to []
  197.   set gTemp to 0
  198.   
  199.   set gMoons to 0
  200.   set gMoonsClicked to 0
  201.   
  202.   set gRingsClicked to 0
  203.   
  204.   set gElementClicked to [0,0,0,0]
  205. end
  206.  
  207.  
  208. -- ïï decreasePower ïï
  209. on decreasePower amount
  210.   
  211.   global gPower
  212.   
  213.   set gPower to gPower + amount
  214.   
  215.   set s to 6
  216.   puppetSprite s, TRUE
  217.   
  218.   set c to the castNum of sprite s
  219.   set cLowest to the number of cast "Zero Power"
  220.   
  221.   if c + amount <= cLowest then
  222.     set the castNum of sprite s to c + amount
  223.   else
  224.     set the castNum of sprite s to cLowest
  225.   end if
  226.   
  227.   if gPower >= 17 then
  228.     doPlaySeries( "power3", "", "", TRUE, TRUE )
  229.   else if gPower >= 15  then
  230.     doPlaySeries( "power2", "", "", TRUE, TRUE )
  231.   else if gPower >= 13 then
  232.     doPlaySeries( "power1", "", "", TRUE, TRUE )
  233.   end if
  234.   
  235. end
  236.  
  237. -- ïï doSwitch ïï
  238. -- handle funky switch control
  239. on doSwitch theSprite
  240.   set c to the castNum of sprite theSprite
  241.   
  242.   puppetSprite theSprite, TRUE
  243.   set the castNum of sprite theSprite to c + 1
  244.   updateStage
  245.   
  246.   set the castNum of sprite theSprite to c + 2
  247.   updateStage
  248.   
  249.   --puppetSprite theSprite, FALSE
  250.   
  251.   return TRUE
  252. end doSwitch
  253.  
  254.  
  255.