script_enemy_main
{    
    let imgEnemy="script\DanMUku\Stage5\Image\Maskass.png";
    let count=-100;
    let a=50;
    let b=70;
    let player = 0;
    let angle = GetAngle;
    let bomb = false;
   @Initialize
   {
      LoadGraphic(imgEnemy);
            SetLife(500); 
   }
   
   @MainLoop
   {
          SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 16);
if(OnBomb)
{
bomb=true;
}

if(count%10==0)
{
if(a==122)
{
a=50;
b=70;
}
else
{
a+=24;
b+=24;
}
}
if(count==50)
{
SetSpeed(0);
}
if(count==200&&angle<=90)
{
SetSpeed(3);
SetAngle(angle+90);
}
if(count==300&&angle>90)
{
SetSpeed(3);
SetAngle(angle-90);
}
angle=GetAngle;
count++;
   }
   @Finalize
   {
	SetCommonData(GetArgument, true);
	if (bomb) {
		CreateItem(ITEM_BOMB, rand(GetX-10, GetX+10), rand(GetY-10, GetY+10));   
	}
	else {
		CreateItem(ITEM_1UP, rand(GetX-10, GetX+10), rand(GetY-10, GetY+10)); 
	}
}
   
   @DrawLoop
   {
            SetColor(255,255,255);
            SetRenderState(ALPHA);
            SetTexture(imgEnemy);
            SetGraphicRect(a, 39, b, 85);
            DrawGraphic(GetX,GetY);
if(GetAngle>=90 && GetAngle<=270)
{
SetGraphicAngle(180, 0, 0);
}
else
{
SetGraphicAngle(0, 0, 0);
}
   }
}
