moon cleanup

Charles Spurrill 2010-11-24 12:28:56 -08:00
parent ad6851e49b
commit 8e90caa413
1 changed files with 16 additions and 16 deletions

View File

@ -5,42 +5,42 @@ local phase;
protected func Initialize()
{
var alpha=0;
if(GetTime()<300 || GetTime()>1140) alpha=255;
if(GetTime() < 300 || GetTime() > 1140) alpha=255;
SetClrModulation(RGBa(255,255,255,alpha));
phase=1;
phase = 1;
Phase(true);
this["Parallaxity"] = [40,100];
this["Parallaxity"] = [40,40];
}
public func Phase(bool noAdvance)
{
if(noAdvance!=true)
{
if(phase<=5) phase=phase+1;
if(phase>=6) phase=1;
if(phase <= 5) phase = phase + 1;
if(phase >= 6) phase = 1;
}
if(phase==1) SetGraphics();
if(phase>1) SetGraphics(Format("%d",LocalN("phase")-1));
if(phase==1) SetPosition(LandscapeWidth()/4,LandscapeHeight()/4);
if(phase==2) SetPosition(LandscapeWidth()/3,LandscapeHeight()/5);
if(phase==3) SetPosition(LandscapeWidth()/2,LandscapeHeight()/6);
if(phase==4) SetPosition(LandscapeWidth()-LandscapeWidth()/3,LandscapeHeight()/5);
if(phase==5) SetPosition(LandscapeWidth()-LandscapeWidth()/4,LandscapeHeight()/4);
if(phase == 1) SetGraphics();
if(phase > 1) SetGraphics(Format("%d",phase - 1));
if(phase == 1) SetPosition(LandscapeWidth() / 4,LandscapeHeight() / 4);
if(phase == 2) SetPosition(LandscapeWidth() / 3,LandscapeHeight() / 5);
if(phase == 3) SetPosition(LandscapeWidth() / 2,LandscapeHeight() / 6);
if(phase == 4) SetPosition(LandscapeWidth() - LandscapeWidth() / 3, LandscapeHeight() / 5);
if(phase == 5) SetPosition(LandscapeWidth() - LandscapeWidth() / 4, LandscapeHeight() / 4);
}
//Get phase can also be used to modify the phase... ie: QueryPhase(3) would set
//the phase of the moon to phase 3. QueryPhase() will simply return the current moon phase.
global func GetPhase(int iphase)
public func GetPhase(int iphase)
{
var moonphase=FindObject(Find_ID(Moon))->LocalN("phase");
if(iphase!=nil && iphase<6) FindObject(Find_ID(Moon))->SetPhase(iphase);
var moonphase = phase;
if(iphase != nil && iphase < 6) SetPhase(iphase);
return moonphase;
}
//ties global to local func
public func SetPhase(int iphase)
{
phase=iphase;
phase = iphase;
Phase(true);
}