script_enemy_main
{

	//Oh god it's so nice to be able to use comments again
	let frame = 0;
	let alpha = 255;
	
	//DEFINE DEM IMAGES
	let bkg = GetCurrentScriptDirectory ~ "c6/enem3bg2.png";
	let bkg2 = GetCurrentScriptDirectory ~ "c6/enem3bg1.png";
	let boss = GetCurrentScriptDirectory ~ "c6/enem3.png";
	
    @Initialize
	{
		LoadUserShotData(GetCurrentScriptDirectory ~ "c6/c6shots.txt");
		LoadGraphic(bkg);
		LoadGraphic(bkg2);
		LoadGraphic(boss);
		
		SetLife(3000);
		SetTimer(30);
		//SetScore(1);
		SetInvincibility(120);
		//MagicCircle(false);
		
		SetMovePosition03(GetCenterX, GetCenterY - 120, 15, 5);
		
		intro;
    }

    @MainLoop
	{
		SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 16);
		
		if(alpha>2){alpha-=3;}
		frame++;
		yield;
    }

    @DrawLoop
	{
		//Background
		SetAlpha(255);
		SetColor(200,200,200);
		SetTexture(bkg2);
		SetGraphicRect(0, 0, 1024, 1024);
		DrawGraphic(GetCenterX, GetCenterY);
		
		SetTexture(bkg);
		SetColor(200,200,200);
		SetGraphicRect(0, 0, 512, 512+frame*2);
		SetAlpha(230);
		DrawGraphic(GetCenterX, GetCenterY);
		
		SetTexture(boss);
		SetAlpha(255);
		SetColor(255,255,255);
		if(GetSpeedX<-0.2 && GetSpeedX>=-1){
			SetGraphicRect(192, 75, 256, 150);
			SetGraphicAngle(180, 0, 0);
		}
		else if(GetSpeedX<-1){
			SetGraphicRect(64, 75, 128, 150);
			SetGraphicAngle(180, 0, 0);
		}
		else if(GetSpeedX>0.2 && GetSpeedX<=1){
			SetGraphicRect(192, 75, 256, 150);
			SetGraphicAngle(0, 0, 0);
		}
		else if(GetSpeedX>1){
			SetGraphicRect(64, 75, 128, 150);
			SetGraphicAngle(0, 0, 0);
		}
		else{
			SetGraphicRect(floor(frame/7)*64, 0, 64+floor(frame/7)*64, 75);
		}
		DrawGraphic(GetX,GetY+5*cos(frame*2));
    }

    @Finalize
	{
    }
	
	function Wait(frames){loop(frames){yield;}}
	
	task intro
	{
		PlayMusic(GetCurrentScriptDirectory ~ "bgm/3.mp3");
	}
}