#Text[ޏ]
#ScriptVersion[2]
#BackGround[User]
#Player[FREE]

script_enemy_main
{
        let count=0;
        let cx=GetCenterX();
        let cy=GetCenterY();
        let csd     = GetCurrentScriptDirectory;
        let imgBoss =csd~"img\dot_devil.png";
	let imgEnemy=csd~"img\familiar.png";
	let big=0;
	let imgAngle=0;
	let imgALP1=255;
	let AnimationB=0;
	let AnimationC=0;

	@Initialize
	{
	SetLife(1);
	SetTimer(999);
        SetDamageRate(0,0);
        SetInvincibility(0);
	LoadGraphic(imgBoss);
	LoadGraphic(imgEnemy);
        SetMovePosition02(GetCenterX(),125,100);
	SetEnemyMarker(true);
        TAnime;
	}
	
	@MainLoop
	{
	imgAngle+=5;
	if(imgAngle>=360){imgAngle=0;}
	big+=1;
	if(big>=100){big=100;}
		if(count>=151&&count<=201){
		imgALP1=imgALP1-5;
		}
		if(count==210){
		SetMovePosition02(-100,-100,20);
		}
		if(count==230){
		VanishEnemy();
		}
        count++;
        yield;
	}
	
        @DrawLoop {
		SetRenderState(ALPHA);
		SetTexture(imgEnemy);
		SetGraphicRect(0,0,48,48);
		SetAlpha(imgALP1);
		SetColor(155,0,0);
		SetGraphicScale(0.04*big,4);
		SetGraphicAngle(0,0,imgAngle);
		DrawGraphic(GetX(),GetY());

		SetRenderState(ALPHA);
		SetTexture(imgEnemy);
		SetGraphicRect(0,0,48,48);
		SetAlpha(imgALP1);
		SetColor(155,0,0);
		SetGraphicScale(0.04*big,4);
		SetGraphicAngle(0,0,-imgAngle);
		DrawGraphic(GetX(),GetY());

		SetRenderState(ALPHA);
		SetTexture(imgBoss);
		SetGraphicScale(1,1);
		SetAlpha(imgALP1);
		SetColor(255,255,255);
		SetGraphicAngle(0,0,0);
		SetGraphicRect(128*AnimationC,128*AnimationB,127+128*AnimationC,127+128*AnimationB);
		DrawGraphic(GetX(),GetY());
	}

        @Finalize
        {
        }

    	task TAnime{
			AnimationB=0;
			AnimationC=3;
        		loop(16){yield;}
			AnimationB=1;
		}
}