Galaxium III peacealien

From Hack Wars Wiki

Jump to: navigation, search
#define functions
 
int main(){
 
if(isLocalSet("speakcount")==false){
	setLocal("speakcount",intValue(rand()*100));
	setLocal("wordcount",intValue(rand()*4));
}
 
setLocal("speakcount",getLocal("speakcount")+1);
int speakcount=getLocal("speakcount");
int wordcount=getLocal("wordcount");
if(speakcount>100){
	string word="";
	if(wordcount==0){
		word="Hello.";
	}else if(wordcount==1){
		word="Nice day isn't it?";
	}else if(wordcount==2){
		word="I'm sure that was an accident.";
	}else{
		word="I like you.";
	}
 
	drawTextWorld(word,"courier",10,getX()-32,getY()-32-10,255,255,255,255);
	if(speakcount>150){
		setLocal("wordcount",(wordcount+1)%4);
		setLocal("speakcount",0);
	}
}
 
 
//Have we set the path of the ship.
if(isLocalSet("mode")==false){
	setLocal("mode",0);
}
 
int mode=getLocal("mode");
 
if(isLocalSet("minmove")==false){
	setLocal("minmove",0);
}
int minmove=getLocal("minmove");
 
int lastshoot=getLocal("lastshoot");
setLocal("lastshoot",lastshoot+1);
int playerx=getGlobal("playerx");
int playery=getGlobal("playery");
 
int life=getLocal("life");
int explode=getLocal("explode");
setLocal("life",life+1);
 
int health=getLocal("health");
int anglecount=getLocal("anglecount");
int storeangle=getLocal("storeangle");
int animate=getLocal("animate");
setLocal("animate",animate+1);
int frame_change=0;
int x=getX();
int y=getY();
 
float angle=90.0;
angle=angle-(15*storeangle);
float rotangle=90.0;
rotangle=rotangle-(15*anglecount+33.7);
 
if(explode==0){
 
	//Animate the ship based on its target angle.
	if(animate>3){
 
		int add=0;
		int addcheck=storeangle-anglecount;
		if(storeangle-anglecount<0){
			add=1;
		}else{
			add=(-1);
		}
 
		if(storeangle-anglecount>12||storeangle-anglecount<-12){
			add=add*(-1);
		}
 
		if(storeangle!=anglecount){
			storeangle=storeangle+add;
			if(storeangle<0){
				storeangle=23;
			}else if(storeangle>23){
				storeangle=storeangle-23;
			}
		}
		setLocal("storeangle",storeangle);
		int image=19+(anglecount/8);
		int frame=anglecount%8;
 
        setZRotation(anglecount*15);
		//setImage(image);
		//setFrame(frame);
 
		setLocal("animate",0);
	}
 
	//Check whether the ship is on a patrol and move it accordingly.
	if(mode==0){
		int patrol=getLocal("patrol");
		setLocal("patrol",patrol+1);
		if(patrol%8==0){
			setLocal("anglecount",(storeangle+4)%24);
		}
	}
 
	setLocal("minmove",minmove-1);
 
 
	while(getMessageCount()>0&&explode==0){
			if(getFlag()=="damage"){
				int damage=getMessage();
				health=health-damage;
			}
 
			if(health<=0){
				int objective=getGlobal("objective");
				setGlobal("objective",objective+1);
				setLocal("explode",life);
				setImage(14);
				setGlobal("score",getGlobal("score")+100);
 
				if(rand()<=0.25){
					int s=createSprite(18,14,x,y,2);
					setFrame(s,6);
					setLocal(s,"animate",0);
					setLocal(s,"type","health");
					float aangle=rand()*360.0;
					aangle=intValue(aangle%24)*15.0;
					int ax=intValue((cos(aangle)*1.5));
					int ay=intValue(((-1)*sin(aangle)*1.5));
					setLocal(s,"addx",ax);
					setLocal(s,"addy",ay);
				}
 
			}
			setLocal("health",health);
 
			nextMessage();
	}
}
 
	//Move the shop.
 
	int plx=intValue((cos(angle)*2.0));
	int ply=intValue(((-1)*sin(angle)*2.0));
 
	setX(x+plx);
	setY(y+ply);
 
 
	if(explode>0){
		int img = getImage();
	if(img==14)
		explode(life,explode,false);
	else
		explode(life,explode,true);
	}
}
 
int explode(int life,int explodestart,boolean destroy){
	if(destroy==false){
		drawTextWorld("100","courier",10,getX()-32,getY()-32-(life-explodestart),255,255,255,255);
	}
 
 
if(life<explodestart+3){
	setFrame(0);
}else if(life<explodestart+6){
	setFrame(1);
}else if(life<explodestart+9){
	setFrame(2);
}else if(life<explodestart+12){
	setFrame(3);
}else if(life<explodestart+15){
	setFrame(4);
}else if(life<explodestart+18){
	setFrame(5);
}else if(life<explodestart+21){
	if(destroy==true){
		destroySprite();
	}else{
		setImage(15);
		setLocal("explode",life);
	}
}
}
Personal tools