

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

function ShotOA1(obj,spd,dir,graphic,delay){
	let shot = CreateShotOA1(obj,spd,dir,graphic,delay);
	ManageShot;
	return shot;
		task ManageShot{
		DelayCloud(ObjMove_GetX(obj),ObjMove_GetY(obj),spd,dir,graphic,delay);
		}
	}
	
function LargeBullet(x,y,spd,dir,acc,maxacc,graphic,delay){
	let shot = CreateShotA2(x,y,spd,dir,acc,maxacc,graphic,delay);
	let c = 0;
	DelayCloud(x,y,spd,dir,graphic,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(243){c=[0,389,65,453];} //gray
		case(244){c=[64,389,128,453];} //red
		case(245){c=[0,517,64,581];} //lila
		case(246){c=[64,517,128,581];} //blue
		case(247){c=[0,453,64,517];} //aqua
		case(248){c=[64,453,128,517];} //lime
		case(249){c=[0,581,64,645];} // yellow 
		case(250){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);
		}
	}
	
function StarBullet(x,y,spd,dir,acc,maxacc,graphic,delay){
	let shot = CreateShotA2(x,y,spd,dir,acc,maxacc,graphic,delay);
	let c = 0;
	DelayCloud(x,y,spd,dir,graphic,delay);
	ManageShot;
	return shot;
	task ManageShot{
	while(!Obj_IsDeleted(shot)){
	if(c%4==0 && c>delay){
	StarEff(ObjMove_GetX(shot),ObjMove_GetY(shot));
	}
	c++;
	yield;
	}
	}
		task StarEff(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];
		let count = 0;
		alternative(graphic)
		case(229){c=[257,0,288,31];} //gray
		case(230){c=[288,0,320,31];} //red
		case(231){c=[320,0,352,31];} //purple
		case(232){c=[172,396,213,437];} //blue
		case(233){c=[384,0,416,31];} //aqua
		case(234){c=[416,0,448,31];} //lime
		case(235){c=[448,0,480,31];} // yellow 
		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_SetAlpha(obj,color);
		count++;
		color -= 5;
		scale -= 0.025;
		yield;
		}
		Obj_Delete(obj);
		}
	}

task DelayCloud(x,y,spd,dir,graphic,delay){
	 let img=GCSD~"shot/ZUNShot.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(graphic>=33 && graphic <=47){ // ARROW_HEAD
	 px = graphic-33;
	 ObjSprite2D_SetSourceRect(obj,0+px*16,16,16+px*16,34);
	 }
	 if(graphic>=48 && graphic <=62){ // SMALL_OUTER
	 adc = true;
	 ObjRender_SetBlendType(obj,BLEND_ADD_RGB);
	 px = graphic-48;
	 ObjSprite2D_SetSourceRect(obj,207+px*19,613,227+px*19,633);
	 }
	 if(graphic>=63 && graphic <=77){ // SMALL_BULLET
	 px = graphic-63;
	 adc = true;
	 ObjRender_SetBlendType(obj,BLEND_ADD_RGB);
	 //ObjSprite2D_SetSourceRect(obj,0+px*16,47,16+px*16,63);
	 ObjSprite2D_SetSourceRect(obj,207+px*19,613,227+px*19,633);
	 }
	 if(graphic>=78 && graphic <=92){ // PELLET
	 px = graphic-78;
	 ObjSprite2D_SetSourceRect(obj,0+px*16,64,16+px*16,80);
	 }
	 if(graphic>=93 && graphic <=105){ // KUNAIL
	 px = graphic-93;
	 ObjSprite2D_SetSourceRect(obj,0+px*16,81,15+px*16,100);
	 }
	 if(graphic>=106 && graphic <=118){ // ICE_PELLET
	 px = graphic-106;
	 ObjSprite2D_SetSourceRect(obj,0+px*16,101,16+px*16,120);
	 }
	 if(graphic>=119 && graphic <=132){ // AMULET
	 px = graphic-119;
	 ObjSprite2D_SetSourceRect(obj,0+px*16,121,16+px*16,139);
	 }
	 if(graphic>=133 && graphic <=146){ // Suppository half fail
	 px = graphic-133;
	 ObjSprite2D_SetSourceRect(obj,0+px*32,330,16+px*32,349);
	 }
	 if(graphic>=147 && graphic <=161){ // DARK PELLET
	 px = graphic-147;
	 ObjSprite2D_SetSourceRect(obj,0+px*16,140,16+px*16,160);
	 }
	 if(graphic>=162 && graphic <=176){ // SMALL STAR
	 v=true;
	 px = graphic-162;
	 ObjSprite2D_SetSourceRect(obj,0+px*16,161,16+px*16,177);
	 }
	 if(graphic>=177 && graphic <=183){ // GLOWING
	 adc = true;
	 ObjRender_SetBlendType(obj,BLEND_ADD_RGB);
	 px = graphic-177;
	 ObjSprite2D_SetSourceRect(obj,257+px*32,160,288+px*32,188);
	 }
	 if(graphic>=185 && graphic <=192){ // DOT
	 px = graphic-185;
	 ObjSprite2D_SetSourceRect(obj,1+px*11,245,11+px*11,255);
	 }
	 if(graphic>=193 && graphic <=197){ // LARGE_DOT
	 adc = true;
	 ObjRender_SetBlendType(obj,BLEND_ADD_RGB);
	 px = graphic-193;
	 ObjSprite2D_SetSourceRect(obj,90+px*16,241,106+px*16,255);
	 }
	 if(graphic>=198 && graphic <=204){ // RAINBOW_DOT
	 px = graphic-198;
	 ObjSprite2D_SetSourceRect(obj,0+px*8,191,8+px*8,199);
	 }
	 if(graphic>=205 && graphic <=213){ // RAINBOW_DOT
	 px = graphic-205;
	 ObjSprite2D_SetSourceRect(obj,0+px*8,199,8+px*8,207);
	 }
	 if(graphic>=214 && graphic <=228){ // MURASA
	 adc = true;
	 ObjRender_SetBlendType(obj,BLEND_ADD_RGB);
	 px = graphic-214;
	 ObjSprite2D_SetSourceRect(obj,0+px*16,310,16+px*16,324);
	 }
	 if(graphic>=229 && graphic <=235){ // LARGE_STAR
	 v = true;
	 px = graphic-229;
	 ObjSprite2D_SetSourceRect(obj,257+px*32,0,288+px*32,31);
	 }
	 if(graphic>=236 && graphic <=242){ // LARGE_BULLET
	 px = graphic-236;
	 ObjSprite2D_SetSourceRect(obj,257+px*32,32,289+px*32,62);
	 }
	 if(graphic>=243 && graphic <=250){ // LARGE_BULLET
	 adc = true;
	 ObjRender_SetBlendType(obj,BLEND_ADD_RGB);
	 px = graphic-243;
	 ObjSprite2D_SetSourceRect(obj,0+px*32,358,32+px*32,387);
	 }
	 if(graphic>=251 && graphic <=257){ // BUTTERFLIES
	 px = graphic-251;
	 ObjSprite2D_SetSourceRect(obj,257+px*32,64,288+px*32,93);
	 }
	 if(graphic>=258 && graphic <=264){ // KNIFE
	 px = graphic-258;
	 ObjSprite2D_SetSourceRect(obj,256+px*32,93,288+px*32,127);
	 }
	 if(graphic>=265 && graphic <=271){ // OVAL
	 px = graphic-265;
	 ObjSprite2D_SetSourceRect(obj,256+px*32,127,288+px*32,158);
	 }
	 if(graphic>=272 && graphic <=275){ // BUBBLE
	 adc = true;
	 ObjRender_SetBlendType(obj,BLEND_ADD_RGB);
	 px = graphic-272;
	 ObjSprite2D_SetSourceRect(obj,256+px*64,190,320+px*64,254);
	 }
	 if(graphic>=276 && graphic <=279){ // BUBBLE
	 adc = true;
	 ObjRender_SetBlendType(obj,BLEND_ADD_RGB);
	 px = graphic-276;
	 ObjSprite2D_SetSourceRect(obj,256+px*64,257,320+px*64,321);
	 }
	 if(graphic>=280 && graphic <=283){ // DARK_BUBBLE
	 px = graphic-280;
	 ObjSprite2D_SetSourceRect(obj,512+px*64,190,576+px*64,254);
	 }
	 if(graphic>=284 && graphic <=287){ // DARK_BUBBLE
	 px = graphic-284;
	 ObjSprite2D_SetSourceRect(obj,512+px*64,257,576+px*64,321);
	 }
	 if(graphic>=300 && graphic <=306){ // HEARTH
	 px = graphic-300;
	 ObjSprite2D_SetSourceRect(obj,1+px*32,208,32+px*32,238);
	 }
	 if(graphic>=323 && graphic <=330){ // FUTO_ARROW
	 px = graphic-323;
	 ObjSprite2D_SetSourceRect(obj,518+px*32,17,542+px*32,57);
	 }
	 if(graphic>=315 && graphic<=322){	
	 adc = true;
	 ObjRender_SetBlendType(obj,BLEND_ADD_RGB);
	 }
	 alternative(graphic)
	 case(315){ObjSprite2D_SetSourceRect(obj,0,389,65,453);} //ORB
	 case(316){ObjSprite2D_SetSourceRect(obj,64,389,128,453);}
	 case(317){ObjSprite2D_SetSourceRect(obj,0,453,64,517);}
	 case(318){ObjSprite2D_SetSourceRect(obj,64,453,128,517);}
	 case(319){ObjSprite2D_SetSourceRect(obj,0,517,64,581);}
	 case(320){ObjSprite2D_SetSourceRect(obj,64,517,128,581);}
	 case(321){ObjSprite2D_SetSourceRect(obj,0,581,64,645);}
	 case(322){ObjSprite2D_SetSourceRect(obj,64,581,128,645);}
	
	 if(graphic>=292 && graphic<=299){	
	 adc = true;
	 ObjRender_SetBlendType(obj,BLEND_ADD_RGB);
	 }
	 alternative(graphic)
	 case(292){ObjSprite2D_SetSourceRect(obj,172,396,213,437);} // OZZIE
	 case(293){ObjSprite2D_SetSourceRect(obj,344,396,385,437);}
	 case(294){ObjSprite2D_SetSourceRect(obj,172,446,213,487);}
	 case(295){ObjSprite2D_SetSourceRect(obj,344,446,385,487);}
	 case(296){ObjSprite2D_SetSourceRect(obj,172,501,213,542);}
	 case(297){ObjSprite2D_SetSourceRect(obj,344,501,385,542);}
	 case(298){ObjSprite2D_SetSourceRect(obj,172,559,213,600);}
	 case(299){ObjSprite2D_SetSourceRect(obj,344,559,385,600);}
	 ObjSprite2D_SetDestCenter(obj);
	 ObjRender_SetPosition(obj,x,y,0);
	 while(c<delay){
	 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);
	 }