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 >
Wrap
Text File
|
1996-03-27
|
8KB
|
255 lines
global gSkyColorList, gSkyColor
global gDistList, gDist
global gDayLengthList, gDayLength
global gMagList, gMag
global gWeightList, gWeight
global gTempList, gTemp
global gMoons, gMoonsClicked, gRingsClicked
global gElementClicked
global gAttrList, gChoosing
-- ïï doAnimate ïï
on doAnimate
global gTellGameToRestore
--if soundBusy(2) then exit
if gTellGameToRestore then gameRestorePuppets()
if(gChoosing = FALSE ) then
-- check skycolor
if( gSkyColor > 0 AND gSkyColor <= count(gSkyColorList)) then
set s to 12
puppetSprite(s,TRUE)
set the locH of sprite s to getAt(gSkyColorList,gSkyColor)
set gSkyColor to gSkyColor + 1
end if
-- check distance from sun
if( gDist > 0 ) then
--put "doAnimate: distcast = ", gDist, getAt(gDistList,gDist)
set s to 15
puppetSprite(s,TRUE)
set the castNum of sprite s to getAt(gDistList,gDist)
set gDist to gDist + 1
if( gDist > count(gDistList) ) then set gDist to gDist - 7
end if
-- check day length
if( gDayLength > 0 ) then
--put "doAnimate: DayLengthcast = ", gDayLength, getAt(gDayLengthList,gDayLength)
set s to 13
puppetSprite(s,TRUE)
set the castNum of sprite s to getAt(gDayLengthList,gDayLength)
set gDayLength to gDayLength + 1
if( gDayLength > count(gDayLengthList) ) then set gDayLength to gDayLength - 7
end if
-- check weight
if( gWeight > 0 ) then
set s to 14
puppetSprite(s,TRUE)
set the locV of sprite s to getAt(gWeightList,gWeight)
set gWeight to gWeight + 1
if( gWeight > count(gWeightList) ) then set gWeight to count(gWeightList) - 5
end if
-- check temp
if( gTemp > 0 ) then
set s to 9
puppetSprite(s,TRUE)
set the loch of sprite s to getAt(gTempList,gTemp)
set gTemp to gTemp + 1
if gTemp > count(gTempList) then set gTemp to gTemp - 6
end if
-- check magnetic field
if( gMag > 0 ) then
set s to 7
puppetSprite(s,TRUE)
set the castNum of sprite s to getAt(gMagList,gMag)
set gMag to gMag + 1
if( gMag > count(gMagList) ) then set gMag to gMag - 6
end if
-- check moons
if gMoons <> 0 then
set s to 16
set gMoons to random(9)
set the castNum of sprite s to ((the number of cast "1 Moon") + gMoons-1)
end if
-- check the static
set s to 8
if the castNum of sprite s <> 0 AND the frame < 15 then
if the name of cast the castNum of sprite s contains "static" then
puppetSprite s, TRUE
set n to value(word 2 of the name of cast (the castNum of sprite s))
set the castNum of sprite s to the number of cast ("Static" && string(n mod 2 + 1))
end if
end if
-- and tell everybody to redraw
updateStage
end if
end
-- ïï setPlanet ïï
-- set up which planet we're looking at
on setPlanet
-- pick a planet
set p to random(9)
-- set up the attributes
if( p = 1 ) then
-- mercury
set theList to [-200,200]
set theTemp to getAt( theList, random(2))
set gAttrList to [#name:"mercury",#distance:0, #skycolor:"black", #daylength:40, ¬
#surfacetemp:theTemp, #gravity:-1, #magfield:0,#rings:0,#moons:0,#h:0, #n:0,#CH4:0,#CO2:0]
else if( p = 2 ) then
-- venus
set gAttrList to [#name:"venus", #distance:0, #skycolor:"yellow", #daylength:40, ¬
#surfacetemp:200, #gravity:0, #magfield:0,#rings:0,#moons:0,#h:0, #n:1,#CH4:0,#CO2:1]
else if( p = 3 ) then
-- moon
set gAttrList to [#name:"moon", #distance:0, #skycolor:"black", #daylength:40, ¬
#surfacetemp:0, #gravity:-1, #magfield:0,#rings:0,#moons:0,#h:0, #n:0,#CH4:0,#CO2:0]
else if( p = 4 ) then
-- mars
set theList to ["Mars 1", "mars 2"]
set theMoon to the number of cast getAt( theList, random(count(theList)))
set gAttrList to [#name:"mars",#distance:100, #skycolor:"red", #daylength:22, #surfacetemp:0, ¬
#gravity:-1, #magfield:0,#rings:0,#moons:1,#moonNum:theMoon,#h:0, #n:1,#CH4:0,#CO2:1]
else if( p = 5 ) then
-- jupiter
set theList to ["red", "orange", "yellow"]
set theColor to getAt( theList, random(3))
set theMoon to the number of cast "Io (Jupiter)"
set gAttrList to [#name:"jupiter",#distance:100, #skycolor:theColor, #daylength:0, ¬
#surfacetemp:-200, #gravity:1, #magfield:2,#rings:1,#moons:10,#moonNum:theMoon, ¬
#h:1, #n:0,#CH4:1,#CO2:0]
else if( p = 6 ) then
-- saturn
set theList to ["orange", "yellow"]
set theColor to getAt( theList, random(2))
set theList to ["Saturn 1", "Titan (Saturn)", "Mimas (Saturn)"]
set theMoon to the number of cast getAt( theList, random(count(theList)))
set gAttrList to [#name:"saturn",#distance:100, #skycolor:theColor, #daylength:0, ¬
#surfacetemp:-200, #gravity:0, #magfield:1,#rings:1,#moons:10,#moonNum:theMoon, ¬
#h:1, #n:0,#CH4:0,#CO2:0]
else if( p = 7 ) then
-- uranus
set theList to ["Umbriel (Uranus)", "Titania (Uranus)", "Oberon (Uranus)"]
set theMoon to the number of cast getAt( theList, random(count(theList)))
set gAttrList to [#name:"uranus",#distance:1000, #skycolor:"blue", #daylength:0, ¬
#surfacetemp:-200,#gravity:0, #magfield:1,#rings:1,#moons:10,#moonNum:theMoon, ¬
#h:1, #n:0,#CH4:1,#CO2:0]
else if( p = 8 ) then
-- neptune
set theMoon to the number of cast "Triton (Neptune)"
set gAttrList to [#name:"neptune",#distance:1000, #skycolor:"blue", #daylength:0, ¬
#surfacetemp:-200, #gravity:0, #magfield:1,#rings:1,#moons:1,#moonNum:theMoon, ¬
#h:1, #n:0,#CH4:1,#CO2:0]
else if( p = 9 ) then
-- pluto
set theMoon to the number of cast "Charon (Pluto)"
set gAttrList to [#name:"pluto",#distance:1000, #skycolor:"black", #daylength:40, ¬
#surfacetemp:-200,#gravity:-1, #magfield:0,#rings:0,#moons:1,#moonNum:theMoon, ¬
#h:0, #n:1,#CH4:1,#CO2:0]
end if
-- add in the planet num
addProp(gAttrList,#planet,p)
set gSkyColorList to []
set gSkyColor to 0
set gDistList to []
set gDist to 0
set gDayLengthList to []
set gDayLength to 0
set gMagList to []
set gMag to 0
set gWeightList to []
set gWeight to 0
set gTempList to []
set gTemp to 0
set gMoons to 0
set gMoonsClicked to 0
set gRingsClicked to 0
set gElementClicked to [0,0,0,0]
end
-- ïï decreasePower ïï
on decreasePower amount
global gPower
set gPower to gPower + amount
set s to 6
puppetSprite s, TRUE
set c to the castNum of sprite s
set cLowest to the number of cast "Zero Power"
if c + amount <= cLowest then
set the castNum of sprite s to c + amount
else
set the castNum of sprite s to cLowest
end if
if gPower >= 17 then
doPlaySeries( "power3", "", "", TRUE, TRUE )
else if gPower >= 15 then
doPlaySeries( "power2", "", "", TRUE, TRUE )
else if gPower >= 13 then
doPlaySeries( "power1", "", "", TRUE, TRUE )
end if
end
-- ïï doSwitch ïï
-- handle funky switch control
on doSwitch theSprite
set c to the castNum of sprite theSprite
puppetSprite theSprite, TRUE
set the castNum of sprite theSprite to c + 1
updateStage
set the castNum of sprite theSprite to c + 2
updateStage
--puppetSprite theSprite, FALSE
return TRUE
end doSwitch