task ShotDelay(obj,time)
{
	ObjShot_SetIntersectionEnable(obj,false);
	let speed = ObjMove_GetSpeed(obj);
	let scale = 2;
	let alpha = 0;
	let angle = ObjMove_GetAngle(obj);
	loop(time)
	{
		ObjMove_SetSpeed(obj,0);
		ObjMove_SetAngle(obj,angle);
		ObjRender_SetAlpha(obj,alpha);
		ObjRender_SetScaleXYZ(obj,scale,scale,scale);
		scale-=1/(time-1);
		alpha+=255/(time-1);
		yield;
	}
	ObjShot_SetIntersectionEnable(obj,true);
	ObjMove_SetSpeed(obj,speed);
}

task ShotFade(obj,time)
{
	ObjShot_SetIntersectionEnable(obj,false);
	let scale = 1;
	let alpha = 255;
	loop(time)
	{
		ObjMove_SetSpeed(obj,0);
		ObjRender_SetAlpha(obj,alpha);
		ObjRender_SetScaleXYZ(obj,scale,scale,scale);
		scale+=1/(time-1);
		alpha-=255/(time-1);
		yield;
	}
	Obj_Delete(obj);
}

function ShootShapeA(spawnX, spawnY, size, v, angle, angle2, num, bside, graphic, delay) {
	ascent(i in 0..num) {
		let sx = spawnX+cos(angle+i*360/num); 
		let sy = spawnY+sin(angle+i*360/num); 
		let sxN = spawnX+cos(angle+(i+1)*360/num); 
		let syN = spawnY+sin(angle+(i+1)*360/num);
		let a = atan2(sy-spawnY,sx-spawnX);
		let obj = CreateShotA1(spawnX+cos(angle+i*360/num)*size*(((sx-spawnX)^2+(sy-spawnY)^2)^0.5), spawnY+sin(angle+i*360/num)*size*(((sx-spawnX)^2+(sy-spawnY)^2)^0.5), v, angle2, graphic, 0);
		ShotDelay(obj,delay);
		ascent(j in 0..bside) {
			let toAngle = atan2(syN-sy,sxN-sx); 
			let toDist = (((sxN-sx)^2+(syN-sy)^2)^0.5); 
			let sx2 = sx+toDist/bside*j*cos(toAngle); 
			let sy2 = sy+toDist/bside*j*sin(toAngle);
			let obj2 = CreateShotA1(spawnX+cos(atan2(sy2-spawnY,sx2-spawnX))*size*(((sx2-spawnX)^2+(sy2-spawnY)^2)^0.5), spawnY+sin(atan2(sy2-spawnY,sx2-spawnX))*size*(((sx2-spawnX)^2+(sy2-spawnY)^2)^0.5), v, angle2, graphic, 0);
			ShotDelay(obj2,delay);
		}
	}
}

function ShootShapeB(spawnX, spawnY, v, angle, num, bside, graphic, delay) {
	ascent(i in 0..num) {
		let sx = spawnX+cos(angle+i*360/num); let sy = spawnY+sin(angle+i*360/num); let sxN = spawnX+cos(angle+(i+1)*360/num); let syN = spawnY+sin(angle+(i+1)*360/num);
		let obj = CreateShotA1(spawnX, spawnY, v*(((sx-spawnX)^2+(sy-spawnY)^2)^0.5), atan2(sy-spawnY,sx-spawnX), graphic, 0);
		ShotDelay(obj,delay);
		ascent(j in 0..bside) {
			let toAngle = atan2(syN-sy,sxN-sx); let toDist = (((sxN-sx)^2+(syN-sy)^2)^0.5); let sx2 = sx+toDist/bside*j*cos(toAngle); let sy2 = sy+toDist/bside*j*sin(toAngle);
			let obj2 = CreateShotA1(spawnX, spawnY, v*(((sx2-spawnX)^2+(sy2-spawnY)^2)^0.5), atan2(sy2-spawnY,sx2-spawnX), graphic, 0);
			ShotDelay(obj2,delay);
		}
	}
}