#include"./../Spells/LoadGraphics.txt"

task TExplosionA(x, y, z, dAlpha, dScale, dScale2){
	let path = expl;
	let obj = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(obj, path);
	Obj_SetRenderPriority(obj, 0.8);
	ObjRender_SetBlendType(obj, BLEND_ADD_RGB);
	ObjSprite2D_SetSourceRect(obj, 1, 1, 63, 63);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetPosition(obj, x, y, 0);
	ObjRender_SetAngleZ(obj ,z);

	let scale = 0;
	let scale2 = 0;
	let alpha = 255;
	while(alpha > 0){
		ObjRender_SetColor(obj, alpha, alpha, alpha);
		ObjRender_SetScaleXYZ(obj, scale, scale2, 1);

		scale2 += dScale2;
		scale += dScale;
		alpha -= dAlpha;
		yield;}
	Obj_Delete(obj);}

task TExplosionB(x,y,color){
	let path = expl2;
	let obj = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(obj, path);
	Obj_SetRenderPriority(obj,0.65);
	ObjRender_SetBlendType(obj, BLEND_ADD_ARGB);
	if(color == "RED"){ObjSprite2D_SetSourceRect(obj,128,15,192,80);}
	if(color == "BLUE"){ObjSprite2D_SetSourceRect(obj,192,15,256,80);}
	if(color == "YELLOW"){ObjSprite2D_SetSourceRect(obj,0,80,64,144);}
	if(color == "GREEN"){ObjSprite2D_SetSourceRect(obj,64,80,128,144);}
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetPosition(obj,x,y,0);
	ObjRender_SetAngleZ(obj,rand(0,360));

	let scale1 = 0;
	let scale2 = 0;
	let dScale1 = 0.3;
	let dScale2 = 0.1;
	let alpha = 255;
	while(alpha > 0){
		ObjRender_SetAlpha(obj,alpha);
		ObjRender_SetScaleXYZ(obj,scale1,scale2,1);
		scale1+=dScale1;
		scale2+=dScale2;
		dScale1-=0.01;
		dScale2-=0.005;
		alpha-=10;
		yield;}
	Obj_Delete(obj);}
