InstallFont(GetCurrentScriptDirectory ~ "MyriadPro-BoldCond");
let Img_CT = GetCurrentScriptDirectory ~ "Cut_in.png";
let Img_CT2 = GetCurrentScriptDirectory ~ "Cut_in_Img.png";

task ObjCutin_Name(name){
		
	let Obj_Cutin = ObjPrim_Create(OBJ_SPRITE_2D);
	Obj_SetRenderPriorityI(Obj_Cutin,23);
	ObjPrim_SetTexture(Obj_Cutin,Img_CT2); 
	ObjSprite2D_SetSourceRect(Obj_Cutin,0,0,540,700);
	ObjSprite2D_SetDestRect(Obj_Cutin,0,0,540,700);
	ObjRender_SetScaleXYZ(Obj_Cutin,1,1,0);	
		
	let Obj_Img = ObjPrim_Create(OBJ_SPRITE_2D);
	Obj_SetRenderPriorityI(Obj_Img,22);
	ObjPrim_SetTexture(Obj_Img,Img_CT); 
	ObjSprite2D_SetSourceRect(Obj_Img,0,0,300,75);
	ObjSprite2D_SetDestRect(Obj_Img,0,0,300,75);
	ObjRender_SetScaleXYZ(Obj_Img,1,1,0);
	
		
	let textObj = ObjText_Create();
	
    ObjText_SetText(textObj, name);
	
    ObjText_SetFontSize(textObj, 21);
    ObjText_SetFontType(textObj, "MyriadPro-BoldCond");
	ObjText_SetFontBorderType(textObj,BORDER_FULL);
	ObjText_SetFontBorderWidth(textObj,2);
	ObjText_SetFontBorderColor(textObj,0,0,0);
	ObjText_SetHorizontalAlignment(textObj, ALIGNMENT_LEFT);
	ObjText_SetMaxWidth(textObj,384);
	Obj_SetRenderPriorityI(textObj, 70);
	
	ObjRender_SetPosition(Obj_Img,GetStgFrameWidth/2,GetStgFrameHeight/2,0);
	
	Move_Cut_In(Obj_Cutin, 100, -250, 60);
	
	Move_Obj(textObj,400,40,0,60, 60);
	Move_Obj(Obj_Img,375,15,-40,60, 60);
}

task Move_Obj(obj, PosY, PosY2, XPos_Add, delayA, delayB){

ObjRender_SetY(obj,PosY);
ObjRender_SetAlpha(obj, 0);

let PosX_A = GetStgFrameWidth/2;
let PosX_B = GetStgFrameWidth/10;

let Xadd = PosX_A - PosX_B;
let Alpha = 0;


loop(30){
	Alpha += 255/30;
	ObjRender_SetX(obj,PosX_A+XPos_Add);
	ObjRender_SetAlpha(obj, Alpha);
	PosX_A -= Xadd/30;
	yield;
}

loop(delayA){yield;}



loop(30){
	Alpha -= 255/30;
	ObjRender_SetX(obj,PosX_A+XPos_Add);
	ObjRender_SetAlpha(obj, Alpha);
	PosX_A -= Xadd/60;
	yield;
}

loop(delayB){yield;}

PosX_A = GetStgFrameWidth/2;
ObjRender_SetY(obj,PosY2);

loop(30){
	Alpha += 255/30;
	ObjRender_SetX(obj,PosX_A+XPos_Add);
	ObjRender_SetAlpha(obj, Alpha);
	PosX_A -= Xadd/30;
	yield;
}
}



task Move_Cut_In(obj, PosY, XPos_Add, delayA){

ObjRender_SetY(obj,PosY);
ObjRender_SetAlpha(obj, 0);

let PosX_A = GetStgFrameWidth/2;
let PosX_B = GetStgFrameWidth/10;

let Xadd = PosX_A - PosX_B;
let Alpha = 0;


loop(30){
	Alpha += 255/30;
	ObjRender_SetX(obj,PosX_A+XPos_Add);
	ObjRender_SetAlpha(obj, Alpha);
	PosX_A += Xadd/30;
	yield;
}

loop(delayA){yield;}



loop(30){
	Alpha -= 255/30;
	ObjRender_SetX(obj,PosX_A+XPos_Add);
	ObjRender_SetAlpha(obj, Alpha);
	PosX_A += Xadd/60;
	yield;
}

}

/*
task Cutin(img){
	let fade = 255;	
	let move = 180;
	
	let obj = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(obj, img);
	ObjSprite2D_SetSourceRect(obj, 0,0,200,365);
	ObjSprite2D_SetDestRect(obj, 0,0,200,365);
	Obj_SetRenderPriorityI(obj, 70);
	ObjRender_SetScaleXYZ(obj, 1.5, 1.5, 0);

	while(!Obj_IsDeleted(obj)){
		ObjRender_SetPosition(obj, 60, move, 0);
		fade=fade-1.7;
		ObjRender_SetAlpha(obj, fade);
		move=move-3;
		yield;
	}	
}


task Spell(name){
	
	let obj = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(obj, splText);
	ObjSprite2D_SetSourceRect(obj, 0,255,255,292);
	ObjSprite2D_SetDestRect(obj, 0,0,256,45);
	Obj_SetRenderPriorityI(obj, 50);
	ObjRender_SetX(obj, 110);
	ObjRender_SetY(obj, 5);
	ObjRender_SetScaleXYZ(obj, 1, 1, 0);
	
}*/