#Title[アリス]
#Text[アリスの登場]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main
{
        let count=0;
        let cx=GetCenterX();
        let cy=GetCenterY();
	let AnimationA=0;
	let AnimationB=0;
	let AnimationC=0;
	let angle=0;
	let imgAngle=0;
        let csd     = GetCurrentScriptDirectory;
        let imgBoss =csd~"img\dot_EXalice.png";

	@Initialize
	{
        SetLife(1);
        SetTimer(999);
	SetX(-10);
	SetY(200);
	SetEnemyMarker(true);
	SetMovePosition03(GetCenterX,150,10,5);
        SetInvincibility(150);
	LoadGraphic(imgBoss);
	SetEnemyMarker(true);
        TAnime;
	}
	
	@MainLoop
	{
	if(count>=75&&count<111){
        	imgAngle+=20;
        	}
	if(count==111){
		AddLife(-1000);
		}
        SetCollisionB(GetX(),GetY(),18);
	SetCollisionA(GetX(),GetY(),18);
        count++;
        yield;
	}
	
        @DrawLoop {
		SetRenderState(ALPHA);
		SetTexture(imgBoss);
		SetGraphicAngle(0,0,imgAngle);
		SetGraphicScale(1,1);
		SetAlpha(255);
		if(int(GetSpeedX())==0)
		{SetGraphicRect(128*AnimationC,128*AnimationB,127+128*AnimationC,127+128*AnimationB);}
		else if(GetSpeedX()>0){SetGraphicRect(256,256+128*AnimationA,383,383+128*AnimationA);}
		else if(GetSpeedX()<0){SetGraphicRect(256,128*AnimationA,383,127+128*AnimationA);}
		DrawGraphic(GetX(),GetY());
	}
        
        @Finalize
        {
		DeleteGraphic(imgBoss);
        }

	task TAnime{
		loop{
			AnimationB=0;
			AnimationC=0;
        		loop(10){yield;}
			AnimationB=1;
        		loop(10){yield;}
			AnimationB=2;
        		loop(10){yield;}
			}
		}

    	task TAnime2{
			AnimationA=0;
        		loop(10){yield;}
			AnimationA=1;
        		loop(50){yield;}
			AnimationA=0;
        		loop(10){yield;}
		}
}