let text = ObjPrim_Create(OBJ_SPRITE_2D);

@Initialize{

	CreateEndText;

}


@MainLoop{
	yield;
}

task CreateEndText{

	ObjPrim_SetTexture(text,GetCurrentScriptDirectory ~ "./img/Ends.png");
	
	if(GetCommonData("trigger",0) == 0){
		ObjSprite2D_SetSourceRect(text,0,0,239,236);	
	}
	else if(GetCommonData("trigger",0) == 1){
		ObjSprite2D_SetSourceRect(text,240,0,466,236);
	}
	ObjSprite2D_SetDestCenter(text);
	ObjRender_SetBlendType(text,BLEND_ALPHA);
	ObjRender_SetAlpha(text,0);
	ObjRender_SetPosition(text,GetStgFrameWidth/2,GetStgFrameHeight/2,0);
	ascent(i in 0..255/30){ObjRender_SetAlpha(text,i*30); yield;}
	loop(60*6){yield;}
	descent(i in 0..255/30){ObjRender_SetAlpha(text,i*30); yield;}
	Obj_Delete(text);
	
}