

function ShotA1(x,y,spd,dir,graphic,cloud,delay){
	let shot = CreateShotA1(x,y,spd,dir,graphic,delay);
	ManageShot;
	return shot;
		task ManageShot{
		DelayCloud(shot,x,y,spd,dir,graphic,cloud,delay);
		}
	}
	
function ShotA2(x,y,spd,dir,acc,maxacc,graphic,cloud,delay){
	let shot = CreateShotA2(x,y,spd,dir,acc,maxacc,graphic,delay);
	ManageShot;
	return shot;
		task ManageShot{
		DelayCloud(shot,x,y,spd,dir,graphic,cloud,delay);
		}
	}

function ShotOA1(obj,spd,dir,graphic,cloud,delay){
	let shot = CreateShotOA1(obj,spd,dir,graphic,delay);
	ManageShot;
	return shot;
		task ManageShot{
		DelayCloud(shot,ObjMove_GetX(obj),ObjMove_GetY(obj),spd,dir,graphic,cloud,delay);
		}
	}
	
function ShotB2(x,y,xspd,yspd,xacc,yacc,xmax,ymax,graphic,cloud,delay){
	let angle = atan2(yspd,xspd);
	let shot = CreateShotB2(x,y,xspd,yspd,xacc,yacc,xmax,ymax,graphic,delay);
	DelayCloud(shot,x,y,0,angle,graphic,cloud,delay);
	return shot;
}
	
function LooseLaserA1(x,y,spd,dir,length,width,graphic,cloud,delay){
	let shot = CreateLooseLaserA1(x,y,spd,dir,length,width,graphic,delay);
	DelayCloud(shot,x,y,spd,dir,graphic,cloud,delay);
	return shot;
}
	
function LargeBullet(x,y,spd,dir,acc,maxacc,graphic,cloud,delay){
	let shot = CreateShotA2(x,y,spd,dir,acc,maxacc,graphic,delay);
	let c = 0;
	DelayCloud(shot,x,y,spd,dir,graphic,cloud,delay);
	ManageShot;
	return shot;
	task ManageShot{
	while(!Obj_IsDeleted(shot)){
	if(c%4==0 && c>delay){
	LargeEff(ObjMove_GetX(shot),ObjMove_GetY(shot));
	}
	c++;
	yield;
	}
	}
		task LargeEff(x,y){
		let img=GCSD~"shot/ZUNShot.png";
		let obj=ObjPrim_Create(OBJ_SPRITE_2D);
		let scale = 1;
		let color = 255;
		let c = [0,0,0,0];
		alternative(graphic)
		case(300){c=[0,389,65,453];} //gray
		case(301){c=[64,389,128,453];} //red
		case(302){c=[0,517,64,581];} //lila
		case(303){c=[64,517,128,581];} //blue
		case(304){c=[0,453,64,517];} //aqua
		case(305){c=[64,453,128,517];} //lime
		case(306){c=[0,581,64,645];} // yellow 
		case(307){c=[0,581,64,645];} // orange
		ObjPrim_SetTexture(obj,img);
		ObjRender_SetBlendType(obj,BLEND_ADD_RGB);
		ObjSprite2D_SetSourceRect(obj,c[0],c[1],c[2],c[3]);
		ObjRender_SetPosition(obj,x,y,0);
		ObjSprite2D_SetDestCenter(obj);
		while(color>0){
		ObjRender_SetScaleXYZ(obj,scale,scale,scale);
		ObjRender_SetColor(obj,color,color,color);
		//ObjRender_SetPosition(obj,ObjMove_GetX(shot),ObjMove_GetY(shot),0);
		color -= 5;
		scale -= 0.02;
		yield;
		}
		Obj_Delete(obj);
		}
	}
	
task RStar(shot,ang,scale,t){
	 let img=GCSD~"Shot/Default_Shot.png";
	 let obj=ObjPrim_Create(OBJ_SPRITE_2D);
	 let cloud = ObjShot_GetImageID(shot);
	 let x = ObjMove_GetX(shot);
	 let y = ObjMove_GetY(shot);
	scale += 0;
	 let c  = 60;
	 let value = scale/t;
	 ObjPrim_SetTexture(obj,img);
	 let rect = GetShotDataInfoA1(cloud,TARGET_ENEMY,INFO_RECT);
	 ObjSprite2D_SetSourceRect(obj,rect[0],rect[1],rect[2],rect[3]);
	 ObjSprite2D_SetDestCenter(obj);
	 ObjRender_SetPosition(obj,x,y,0);
	 ObjRender_SetAngleXYZ(obj,0,0,ang);
	 ObjRender_SetBlendType(obj,BLEND_ADD_ARGB);
	 ObjRender_SetColor(obj,255,255,255);
	 loop(t){
	ObjRender_SetScaleXYZ(obj,scale,scale,0);
	ObjRender_SetAlpha(obj,c);
	scale -= value;
	c+=180/t;
	 yield;
	 }
	 Obj_Delete(obj);
	}
	
task DelayShot(shot,cloud,s,value,time,delay){
	let cg = true;
	wait(delay);
	if(!Obj_IsDeleted(shot)){
	 let graphic = ObjShot_GetImageID(shot);
	 let result = s-1;
	 let adc = false;
	 let alpha = value;
	 let s_value = 255-value;
	 if(cloud==0){cloud=graphic;}
	 if( (cloud>=161 && cloud<=168) || (cloud>=11 && cloud<=18) || (cloud>=21 && cloud<=28) || (cloud>=101 && cloud<=108) || (cloud>=211 && cloud<=218) || (cloud>=351 && cloud<=358) || (cloud>=151 && cloud<=158)){
	 adc = true;
	 }
	ObjShot_SetGraphic(shot,cloud);
		loop(time){
		ObjRender_SetScaleXYZ(shot,s,s,0);
		if(adc==false){ObjRender_SetAlpha(shot,alpha);}
		else{
		ObjRender_SetColor(shot,alpha,alpha,alpha);
		}
		alpha += s_value/time;
		s -= result/time;
		yield;
		}
		if(cg==false){ObjShot_SetGraphic(shot,graphic);}
		}
	}

task DelayCloud(shot,x,y,spd,dir,graphic,cloud,delay){
	 let img=GCSD~"Shot/Default_Shot.png";
	 let obj=ObjPrim_Create(OBJ_SPRITE_2D);
	 let s = 3;
	 let c = 0;
	 let v = false;
	 let px = 0;
	 let adc = false;
	 ObjPrim_SetTexture(obj,img);
	 ObjRender_SetBlendType(obj,BLEND_ALPHA);
	 ObjRender_SetAngleXYZ(obj,0,0,dir+90);
	 if(x==0 && y==0){x=-300;y=-300;}
	 if(cloud==0){cloud=graphic;}
	 if( (cloud>=161 && cloud<=168) || (cloud>=21 && cloud<=28) || (cloud>=101 && cloud<=108) || (cloud>=211 && cloud<=218) || (cloud>=351 && cloud<=358) || (cloud>=151 && cloud<=158)){
	 adc = true;
	 ObjRender_SetBlendType(obj,BLEND_ADD_RGB);
	 }
	 let rect = GetShotDataInfoA1(cloud,TARGET_ENEMY,INFO_RECT);
	 ObjSprite2D_SetSourceRect(obj,rect[0],rect[1],rect[2],rect[3]);
	 ObjSprite2D_SetDestCenter(obj);
	 ObjRender_SetPosition(obj,x,y,0);
	 while(c<delay && !Obj_IsDeleted(objBoss)){
	 ObjRender_SetScaleXYZ(obj,s,s,0);
	 if(v==true){ ObjRender_SetAngleXYZ(obj,0,0,dir+90-c*3)};
	 if(s>=1){s -= 2.1/delay;}
	 c++;
	 ObjRender_SetAlpha(obj,c*255/(delay*1.25));
	 if(adc==true){ObjRender_SetColor(obj,c*255/(delay*1.25),c*255/(delay*1.25),c*255/(delay*1.25));}
	 yield;
	 }
	 Obj_Delete(obj);
	 }