//==============================================================================
//	 e GtFNg֐
//	̃t@Cinclude_functionŎ荞ނAKvȕRsyĎgp
//==============================================================================
//	[TASK] G𒆐SɌ悤ȃGtFNg\
//	 gpƕ`Fݒ肪ftHgɖ߂
//	@ iSetColor y SetShotColor  255, 255, 255 ݒ肳j
//	 _lgpĂ̂@DrawLoop̕`揈ŎgpȂ
//------------------------------------------------------------------------------
task Spark(
	let frame,		// GtFNg\t[i30ȏj
	let colorR,		// FFԐi0`255j
	let colorG,		// FFΐi0`255j
	let colorB,		// FFi0`255j
	let con01		// Concentration01𓯎 true/false
){
	if( con01 ){
		SetColor( colorR, colorG, colorB );
		Concentration01( frame );
		SetColor( 255, 255, 255 );
	}
	let x = 0;
	let y = 0;
	SetLocation();
	loop( frame - 20 ){
		SetShotColor( colorR, colorG, colorB );
		SparkLine();
		SetShotColor( 255, 255, 255 );
		yield;
	}
	task SetLocation{
		loop( frame ){
			x = GetX();
			y = GetY();
			yield;
		}
	}
	task SparkLine{
		let obj = Obj_Create( OBJ_LASER );
		Obj_SetAngle( obj, rand( 0, 360 ) );
		ObjShot_SetDelay( obj, 20 );
		ObjShot_SetGraphic( obj, WHITE01 );
		ObjLaser_SetWidth( obj, rand( 5, 80 ) );
		ObjLaser_SetSource( obj, false );
		Obj_SetAutoDelete( obj, false );
		Obj_SetCollisionToPlayer( obj, false );
		ObjShot_ToItem( obj, false );
		let Length = 400;
		let accLength = - Length / 20;
		loop( 20 ){
			Length += accLength;
			ObjLaser_SetLength( obj, Length );
			Obj_SetPosition( obj, x, y );
			yield;
		}
		Obj_Delete( obj );
	}
}

//------------------------------------------------------------------------------
//	[TASK] {ƂAoA𒣂ă_[W󂯕tȂ
//	 {Ɏc莞ԁiframej؂ꂽꍇA̎_ŃoAł
//------------------------------------------------------------------------------
task BombBarrierO(
	let frame,		// oA҂t[i0Ŗj
	let pattern,	// oǍ`i3:Op/4:lp/5:/6:_rf/̑:`悵Ȃj
	let radius,		// oA̔a
	let accAngle,	// oẢ]px
	let blur,		// oA̎cԁi1ȏj
	let graphic		// oA̐Fie摜ŎwA****01̒e摜j
){
	let x = 0;
	let y = 0;
	let gapAngle = [];
	let angle = [];
	let Length = 0;
	alternative( pattern )
	case( 3 ){
		gapAngle = [ - 90, 30, 150 ];
		angle = [ 60, 180, - 60 ];
		Length = radius * cos( 30 ) * 2;
	}
	case( 4 ){
		gapAngle = [ - 90, 0, 90, 180 ];
		angle = [ 45, 135, - 135, - 45 ];
		Length = radius * cos( 45 ) * 2;
	}
	case( 5 ){
		gapAngle = [ - 90, - 18, 54, 126, - 162 ];
		angle = [ 72, 144, - 144, - 72, 0 ];
		Length = radius * cos( 18 ) * 2;
	}
	case( 6 ){
		gapAngle = [ - 90, - 30, 30, 90, 150, - 150 ];
		angle = [ 60, 120, 180, - 120, - 60, 0 ];
		Length = radius * cos( 30 ) * 2;
	}
	others{ pattern = 0; }
	let onBarrier = true;
	while( frame > 0 ){
		x = GetX();
		y = GetY();
		if( OnBomb() ){
			SetInvincibility( 2 );
			ascent( let i in 0 .. pattern ){
				Barrier( gapAngle[ i ], angle[ i ] );
				gapAngle[ i ] = gapAngle[ i ] + accAngle;
				angle[ i ] = angle[ i ] + accAngle;
			}
		}
		frame --;
		yield;
	}
	onBarrier = false;
	task Barrier( let _gapAngle, let _angle ){
		let obj = Obj_Create( OBJ_LASER );
		let _x = x + radius * cos( _gapAngle );
		let _y = y + radius * sin( _gapAngle );
		Obj_SetPosition( obj, _x, _y );
		Obj_SetAngle( obj, _angle );
		ObjShot_SetGraphic( obj, graphic );
		ObjLaser_SetLength( obj, Length );
		ObjLaser_SetWidth( obj, 10 );
		ObjLaser_SetSource( obj, false );
		Obj_SetAutoDelete( obj, false );
		Obj_SetCollisionToPlayer( obj, false );
		ObjShot_ToItem( obj, false );
		loop( blur ){
			if( !onBarrier ){ break; }
			yield;
		}
		Obj_Delete( obj );
	}
}
