function SpellCard(time, name, colors, image, image2, y, y2, scale){
	let objScene = GetEnemyBossSceneObjectID();
	ObjEnemyBossScene_StartSpell(objScene);
	BarName(time, name, colors);
	CutinItself(image, image2, y, y2, scale, time);
	ChainSet(time);

	loop(time){yield;}
}

task CutinItself(image, image2, y, y2, scale, time){
	let obj2 = ObjPrim_Create(OBJ_SPRITE_2D);
	let obj = ObjPrim_Create(OBJ_SPRITE_2D);
	
	ObjPrim_SetTexture(obj, image);
	Obj_SetRenderPriority(obj, 1);
	ObjSprite2D_SetSourceRect(obj,0,0,GetTextureWidth(image),GetTextureHeight(image));
	ObjSprite2D_SetDestCenter(obj);	
	ObjRender_SetScaleXYZ(obj,scale,scale,0);
	ObjRender_SetAngleXYZ(obj,0,0,0);
	ObjRender_SetBlendType(obj, BLEND_ALPHA);
	ObjRender_SetColor(obj, 255, 255, 255);
	
	ObjPrim_SetTexture(obj2, image2);
	Obj_SetRenderPriority(obj2, 0.6);
	ObjSprite2D_SetSourceRect(obj2,0,0,GetTextureWidth(image),GetTextureHeight(image));
	ObjSprite2D_SetDestCenter(obj2);	
	ObjRender_SetScaleXYZ(obj2,scale*1.5,scale*1.5,0);
	ObjRender_SetAngleXYZ(obj2,0,0,0);
	ObjRender_SetBlendType(obj2, BLEND_ALPHA);
	ObjRender_SetAlpha(obj2, 122);
	ObjRender_SetColor(obj2, 255, 255, 255);
	
	ObjRender_SetY(obj, GetStgFrameHeight/2+y/2);
	ObjRender_SetX(obj, GetStgFrameWidth+40);
	
	ObjRender_SetY(obj2, GetStgFrameHeight/2+y2);
	ObjRender_SetX(obj2, GetStgFrameWidth/2);
	
	go(obj2);
	
	task go(obj2){
	let a = 0;
	ascent(i in 0..10){
	//ObjRender_SetX(obj2, GetStgFrameWidth/2-15*tan((i+130)*1.1-90));
	ObjRender_SetAlpha(obj2, 0+i*15);
	yield;
	}
	loop(time*0.75){yield;}
	ascent(i in 0..30){
	//ObjRender_SetX(obj2, GetStgFrameWidth/2-15*tan((i+130)*1.1-90));
	ObjRender_SetAlpha(obj2, 122-i*4);
	yield;
	}
	Obj_Delete(obj2);
	}
	
	let a = 0;
	let scaleX = scale;
	
	ascent(i in 0..time){
	ObjRender_SetX(obj, GetStgFrameWidth/2-75*tan(a*1-90));
	ObjRender_SetY(obj, GetStgFrameHeight/2+50*cos(90-a)+y);
	a+=180/time;
	yield;
	}

	/*//SPIN
	ascent(i in 0..time*2){
	ObjRender_SetX(obj, -20+i*5);
	ObjRender_SetAngleZ(obj, i*12);
	yield;
	}*/
	
	
	Obj_Delete(obj);
}

task BarName(time, name, colors){
	let objBar = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjRender_SetBlendType(objBar, BLEND_ALPHA);
	Obj_SetRenderPriority(objBar, 0.8);
	ObjPrim_SetTexture(objBar, GetCurrentScriptDirectory ~ "/img/SpellBar.png");
	ObjSprite2D_SetSourceRect(objBar, 0, 0, 256, 39);
	ObjSprite2D_SetDestCenter(objBar);
	ObjRender_SetColor(objBar, colors[0], colors[1], colors[2]);
	
	let objText = ObjText_Create;
	Obj_SetRenderPriority(objText, 0.9);
	ObjText_SetText(objText,name);
	ObjText_SetFontType(objText, "Modern No. 20");
	ObjText_SetFontSize(objText,12);
	ObjText_SetFontColorBottom(objText,255,255,255);
	ObjText_SetFontColorTop(objText, colors[0], colors[1], colors[2]);
	ObjText_SetFontBorderType(objText,BORDER_FULL);
	ObjText_SetFontBorderColor(objText,32,32,32);
	ObjText_SetFontBorderWidth(objText,1.5);
	ObjText_SetHorizontalAlignment(objText, ALIGNMENT_CENTER);
	ObjText_SetMaxWidth(objText, 400);
	
	ObjRender_SetX(objBar, GetStgFrameWidth/2);
	ObjRender_SetX(objText, -200+GetStgFrameWidth/2);
	
	let spd = 4;
	let move = 0;
	ascent(i in 0..30){
	ObjRender_SetY(objBar, 480-move);
	ObjRender_SetY(objText, 480-6-move);	
	move+=spd;
	if(spd > 0){spd-=4/30}
	yield;
	}
	loop(time/2){yield;}
	spd = 12;
	ascent(i in 0..60){
	ObjRender_SetY(objBar, 480-move);
	ObjRender_SetY(objText, 480-5-move);	
	move+=spd;
	if(spd > 0){spd-=12/60}
	yield;
	}
}


task ChainSet(time){
	ascent(i in 0..12){
	Chain(0, 24+i*40, 0,  0,  90, time);
	}
}

task Chain(x, y, xvel, yvel, ang, time){
	let alpha = 0;
	let obj=ObjPrim_Create(OBJ_SPRITE_2D);
	Obj_SetRenderPriority(obj,0.5);
	ObjPrim_SetTexture(obj,GetCurrentScriptDirectory~"./img/chain.png");
	ObjSprite2D_SetSourceRect(obj,0,0,20,2200);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetScaleXYZ(obj,1,1,1);
	ObjRender_SetBlendType(obj,BLEND_ADD_ARGB);
	ObjRender_SetAlpha(obj, alpha);
	ObjRender_SetAngleZ(obj, ang);
	ObjRender_SetPosition(obj, x,y,0);
	let count = 0;
	loop(time){
	if(alpha<255){alpha+=10;}
	ObjRender_SetAlpha(obj, alpha);
	ObjSprite2D_SetSourceRect(obj,0,count,20,count-2200);
	ObjRender_SetPosition(obj, x+(count/6*xvel),y+(count/6*yvel),0);
	count+=6;
	yield;}
	
	loop(30){
	ObjSprite2D_SetSourceRect(obj,0,count,20,count-2200);
	ObjRender_SetPosition(obj, x+(count/6*xvel),y+(count/6*yvel),0);
	count+=6;
	
	alpha-=255/30;
	ObjRender_SetAlpha(obj,alpha);
	yield;}
	Obj_Delete(obj);
}