script_enemy_main {
let imgEnemy = GetCurrentScriptDirectory ~ "BarrelBlast.png";
@Initialize{
	let enemy = ObjEnemy_Create(OBJ_ENEMY_BOSS);//define boss and register it
	//BG = ObjPrim_Create(OBJ_SPRITE_2D);//not really a boss
	ObjEnemy_Regist(enemy);
	//ObjMove_SetPosition(enemy,192,-100);
    SetLife(10);
 }
@MainLoop{
    ObjEnemy_SetIntersectionCircleToShot(enemy,bossX,bossY,27);//collision for shots and player
	ObjEnemy_SetIntersectionCircleToPlayer(enemy,bossX,bossY,25);
 }
@DrawLoop{
	let x =0;
	ObjPrim_SetTexture(enemy,imgBoss);
	ObjSprite2D_SetSourceRect(enemy,x,0,x+43,43);
	ObjSprite2D_SetDestCenter(enemy);
	ObjRender_SetScaleXYZ(enemy,1,1,0);
	let temp = 0;
    while(!Obj_IsDeleted(enemy)) {
		temp++;
		if(temp==3){
		x = modc(x+57,57*16);
		ObjSprite2D_SetSourceRect(enemy,x,44,x+56,100);
		temp=0;
		}
		yield;
	}
 }
@Finalize{
 }
}