task Death(bx,by){
	loop(1){
		let dir = 0;
		let x = 0;
		con1(bx,by,80);

				LoadSound(GetCurrentScriptDirectory ~ "se/enemoff.wav");
				PlaySE(GetCurrentScriptDirectory ~ "se/enemoff.wav");
				while(x<50){
					con2(bx,by,dir);
					dir+=360/50;
					wait(2);
					x++;
				}
				wait(5);
				

				LoadSound(GetCurrentScriptDirectory ~ "se/enemoff.wav");
				PlaySE(GetCurrentScriptDirectory ~ "se/enemoff.wav");
					con1(bx,by,80);
				while(x<150){
					con2(bx+0*cos(dir+rand(0,360)),by+0*sin(dir+rand(0,360)),dir+rand(-370,380));
					wait(0);
					dir+=360/150;
					x++;
				}
				x = 0;
				dir = 0;

		
			task con2(x,y,r){
			
				let batObj = ObjPrim_Create(OBJ_SPRITE_2D);
				let q = rand(0,360);
				let w = 0;
				let down = 155;
				let scale = rand(2,2.5);
				
				ObjPrim_SetTexture(batObj,GetCurrentScriptDirectory ~ "img/maple.png");
				ObjSprite2D_SetDestRect(batObj,0,0,32,32);
				ObjSprite2D_SetSourceRect(batObj,0,0,32,32);
				ObjSprite2D_SetDestCenter(batObj);
				ObjRender_SetBlendType(batObj,BLEND_ADD_ARGB);
				ObjRender_SetAlpha(batObj,255);
				Obj_SetRenderPriorityI(batObj,70);
				ObjRender_SetPosition(batObj,x+rand(0,10),y+rand(0,10),0);
				ObjRender_SetScaleXYZ(batObj,rand(0,10),rand(0,10),rand(0,10));
					ObjRender_SetAngleXYZ(batObj,rand(0,60),rand(0,60),rand(0,360));
					ObjRender_SetPosition(batObj,x+cos(q)*w,y+sin(q)*w,0);
				
				loop(150){
					scale-=1/45;
					down-=2;
					w-=scale;
				
					ObjRender_SetScaleXYZ(batObj,scale+q/360,scale+q/360,scale+q/360);
					ObjRender_SetPosition(batObj,x+cos(q)*w,y+sin(q)*w,0);
					ObjRender_SetAlpha(batObj,down);
					yield;
				}
				Obj_Delete(batObj);
				yield;
			}
			
			task con1(x,y,w){
				let concObj = ObjPrim_Create(OBJ_SPRITE_2D);
				let spin = 0;
				let dir = 0;
				let p = 0;
				let a = 7;
				let down = 0;
				let scale = 0;
				
				ObjPrim_SetTexture(concObj,GetCurrentScriptDirectory ~ "img/Con1.png");
				ObjSprite2D_SetDestRect(concObj,0,0,128,128);
				ObjSprite2D_SetSourceRect(concObj,0,0,128,128);
				ObjSprite2D_SetDestCenter(concObj);
				ObjRender_SetBlendType(concObj,BLEND_ADD_ARGB);
				ObjRender_SetAlpha(concObj,255);
				Obj_SetRenderPriorityI(concObj,70);
				ObjRender_SetPosition(concObj,x,y,0);
				ObjRender_SetColor(concObj,255,10,65);
				
				loop(120){
					spin+=0.03;
					dir+=360/a;
					scale-=0.005+(spin/100);
					let down = 155*sin(dir/80);
					ObjRender_SetAngleXYZ(concObj,0,0,spin*100+(spin*20));
					ObjRender_SetScaleXYZ(concObj,scale,scale,scale);
					ObjRender_SetAlpha(concObj,155-down);
					yield;
				}
				Obj_Delete(concObj);
				yield;
			}
			yield;
		}
	}

task ConcentrationQ{
	let dir = 0;
	let x = 0;
	while(!Obj_IsDeleted(bossObj)){
	con1(BossX,BossY,80);

			while(x<20 && !Obj_IsDeleted(bossObj)){
				con2(BossX,BossY,dir);
				dir+=360/20;
				wait(2);
				x++;
			}
			x = 0;
			dir = 0;

	
		task con2(x,y,r){
			let batObj = ObjPrim_Create(OBJ_SPRITE_2D);
			
			if(!Obj_IsDeleted(bossObj)){
		
			let batObj = ObjPrim_Create(OBJ_SPRITE_2D);
			let q = rand(0,360);
			let w = rand(140,170);
			let down = 155;
			let scale = rand(2,2.5);
			
			ObjPrim_SetTexture(batObj,GetCurrentScriptDirectory ~ "img/maple.png");
			ObjSprite2D_SetDestRect(batObj,0,0,32,32);
			ObjSprite2D_SetSourceRect(batObj,0,0,32,32);
			ObjSprite2D_SetDestCenter(batObj);
			ObjRender_SetBlendType(batObj,BLEND_ADD_ARGB);
			ObjRender_SetAlpha(batObj,255);
			Obj_SetRenderPriorityI(batObj,70);
			ObjRender_SetPosition(batObj,x+rand(0,10),y+rand(0,10),0);
			ObjRender_SetScaleXYZ(batObj,rand(0,10),rand(0,10),rand(0,10));
				ObjRender_SetAngleXYZ(batObj,rand(0,60),rand(0,60),rand(0,360));
				ObjRender_SetPosition(batObj,x+cos(q)*w,y+sin(q)*w,0);
			if(!Obj_IsDeleted(GetEnemyBossObjectID)){
				loop(150){
					scale-=1/45;
					down-=1;
					w-=2;
				
					ObjRender_SetScaleXYZ(batObj,scale,scale,scale);
					ObjRender_SetPosition(batObj,x+cos(q)*w,y+sin(q)*w,0);
					ObjRender_SetAlpha(batObj,down);
					yield;
				}
			}
			Obj_Delete(batObj);
			
			}
			
			while(IsCloseScript(GetOwnScriptID)){ 
			Obj_Delete(batObj);
			}
			
			while(!Obj_IsDeleted(bossObj)){ yield; }
			Obj_Delete(batObj);
		}
		break;
			
		
		task con1(x,y,w){
			
			if(!Obj_IsDeleted(bossObj)){
			let concObj = ObjPrim_Create(OBJ_SPRITE_2D);
			let spin = 0;
			let dir = 0;
			let p = 0;
			let a = 7;
			let down = 0;
			let scale = 3;
			
			LoadSound(GetCurrentScriptDirectory ~ "se/Charge3.wav");
			PlaySE(GetCurrentScriptDirectory ~ "se/Charge3.wav");
			ObjPrim_SetTexture(concObj,GetCurrentScriptDirectory ~ "img/Con1.png");
			ObjSprite2D_SetDestRect(concObj,0,0,128,128);
			ObjSprite2D_SetSourceRect(concObj,0,0,128,128);
			ObjSprite2D_SetDestCenter(concObj);
			ObjRender_SetBlendType(concObj,BLEND_ADD_ARGB);
			ObjRender_SetAlpha(concObj,255);
			Obj_SetRenderPriorityI(concObj,70);
			ObjRender_SetPosition(concObj,x,y,0);
			ObjRender_SetColor(concObj,155,0,0);
			if(!Obj_IsDeleted(GetEnemyBossObjectID)){
				loop(120){
					spin+=0.03;
					dir+=360/a;
					scale-=0.005+(spin/100);
					let down = 155*sin(dir/100);
					ObjRender_SetAngleXYZ(concObj,0,0,spin*100+(spin*20));
					ObjRender_SetScaleXYZ(concObj,scale,scale,scale);
					ObjRender_SetAlpha(concObj,155-down);
					yield;
				}
			}
			Obj_Delete(concObj);
			
			}
		}
		break;
	}
	}