//魔方陣の色
let MAGIC_RED    = 0;
let MAGIC_ORANGE = 1;
let MAGIC_YELLOW = 2;
let MAGIC_GREEN  = 3;
let MAGIC_AQUA   = 4;
let MAGIC_BLUE   = 5;
let MAGIC_PURPLE = 6;
let MAGIC_WHITE  = 7;

//魔方陣の1辺の長さ
let MAGIC_LENGTH = 256;

/**
 * 魔方陣を描画する
 * 
 * @param {Integer} size     サイズ
 * @param {Integer} roll     回転速度
 * @param {Boolean} isexpand 展開するかどうか
 * @param {Integer} color    色
 */
task DrawMagicCircle( size, roll, isexpand, color ){
	let maxrad = size;
	let rad = 0;
	let angle = 0;
	let expandtime = 90;
	let x = ( color % 4 ) * MAGIC_LENGTH;
	let y = truncate( color / 4 ) * MAGIC_LENGTH;
	
	if( !isexpand ){
		rad = maxrad;
	}
	
	let obj = CreateObjEffect( imgMagicCircle, GetX(), GetY(), x, y, MAGIC_LENGTH, MAGIC_LENGTH, 1, 255, 255, 255, 255 );
	
	while( !Obj_BeDeleted( obj ) ){
		Obj_SetPosition( obj, GetX(), GetY() );
		ObjEffect_SetAngle( obj, 0, 0, angle );
		ObjEffect_SetScale( obj, rad, rad );
		
		angle += roll;
		if( rad < maxrad ){
			rad += maxrad / expandtime;
		}
		
		yield;
	}
}