//This library is for spellcard stuff and weather. Please do not use without asking for permission first.

let finish = GetCurrentScriptDirectory ~ "./SFX/se_finish.wav";
let extend = GetCurrentScriptDirectory ~ "./SFX/se_life.wav";
let spellextend = GetCurrentScriptDirectory ~ "./SFX/se_spellextend.wav";
let timeout = GetCurrentScriptDirectory ~ "./SFX/se_timeout.wav";
let timeout2 = GetCurrentScriptDirectory ~ "./SFX/se_timeout2.wav";
let weather = round(rand(1, 6.4));

let CSD = GetCurrentScriptDirectory;

task CallWeatherSpecified(num)
{
	weather = num;

	CallWeather;
}

task CallWeatherBackground(num)
{
	LoadSound(finish);

	weather = num;

	SetStgFrame(0, 0, 640, 480, 20, 80);
	SetPlayerClip(32, 32, 612, 452);

	RenderLivesAndBombs;
	Background;

	loop(360){yield;}

	ObjEnemy_SetDamageRate(objBoss, 100, 50);
}


task CallWeather
{
	SetStgFrame(0, 0, 640, 480, 20, 80);
	SetPlayerClip(32, 32, 612, 452);

	RenderLivesAndBombs;

	let objBossID = ID_INVALID;
	if(length(GetEnemyBossObjectID) >= 1)
	{
		objBossID = GetEnemyBossObjectID[0];
	}

	LoadSound(finish);
	LoadSound(extend);
	LoadSound(spellextend);

	if(weather == 1)
	{
		SetPlayerRebirthFrame(30);
	}
	else
	{
		SetPlayerRebirthFrame(15);
	}
	if(weather == 4)
	{
		SetPlayerRebirthFrame(0);
	}
	else
	{
		SetPlayerRebirthFrame(15);
	}
	Background;
	loop(30){yield;}
	if(weather == 6)
	{
		SetPlayerLife(GetPlayerLife + 1);
		PlaySE(extend);
	}
	if(weather == 3)
	{
		SetPlayerSpell(GetPlayerSpell + 1);
		PlaySE(spellextend);
	}
	loop(120){yield;}
	RenderWeatherText;
	loop(210){yield;}
	if(weather == 2)
	{
		ObjEnemy_SetDamageRate(objBoss, 100, 100);
	}
	else
	{
		ObjEnemy_SetDamageRate(objBoss, 100, 50);
	}
	if(weather == 5)
	{
		ObjEnemy_SetDamageRate(objBoss, 75, 50);
	}
	else
	{
		ObjEnemy_SetDamageRate(objBoss, 100, 50);
	}
}

task Background()
{
	SetFogEnable(true);

	let obj = ObjPrim_Create(OBJ_SPRITE_3D);
	ObjPrim_SetTexture(obj, CSD ~ "./img/Stgbg.png");
	
	//sets the position of the sprite to the center of the playing field
	ObjRender_SetPosition(obj,0,-194,0);
	Obj_SetRenderPriorityI(obj, 23);
	SetCameraRadius(300);
	SetCameraAzimuthAngle(90);
	SetCameraElevationAngle(-75);

	SetFogParam(270, 325, 0, 0, 0);

	let objTWO = ObjPrim_Create(OBJ_SPRITE_2D);
	let objRain = ObjPrim_Create(OBJ_SPRITE_2D);
	let objRainbow = ObjPrim_Create(OBJ_SPRITE_2D);
	let objSunshine = ObjPrim_Create(OBJ_SPRITE_2D);
	if(weather == 1)
	{
		ObjPrim_SetTexture(objTWO, CSD ~ "./img/StgSkySunny.png");
		ObjPrim_SetTexture(objSunshine, CSD ~ "./img/StgSunshine.png");
		ObjRender_SetBlendType(objSunshine, BLEND_ADD_ARGB);
	}
	if(weather == 2)
	{
		ObjPrim_SetTexture(objTWO, CSD ~ "./img/StgSkyDrizzle.png");
		ObjPrim_SetTexture(objRain, CSD ~ "./img/StgRain.png");
		ObjRender_SetBlendType(objRain, BLEND_ADD_ARGB);
	}
	if(weather == 3)
	{
		ObjPrim_SetTexture(objTWO, CSD ~ "./img/StgSkyCloudy.png");
	}
	if(weather == 4)
	{
		ObjPrim_SetTexture(objTWO, CSD ~ "./img/StgSkySunny.png");
		ObjPrim_SetTexture(objRain, CSD ~ "./img/StgRain.png");
		ObjPrim_SetTexture(objRainbow, CSD ~ "./img/StgRainbow.png");
		ObjPrim_SetTexture(objSunshine, CSD ~ "./img/StgSunshine.png");
		ObjRender_SetBlendType(objSunshine, BLEND_ADD_ARGB);
		ObjRender_SetBlendType(objRain, BLEND_ADD_ARGB);
		ObjRender_SetBlendType(objRainbow, BLEND_ADD_ARGB);
	}
	if(weather == 5)
	{
		ObjPrim_SetTexture(objTWO, CSD ~ "./img/StgSkySpring.png");
	}
	if(weather == 6)
	{
		ObjPrim_SetTexture(objTWO, CSD ~ "./img/StgSkyHeavyFog.png");
	}

	ObjRender_SetPosition(objTWO, 640, 120, 0);
	Obj_SetRenderPriorityI(objTWO, 22);
	Obj_SetRenderPriorityI(objRain, 24);
	Obj_SetRenderPriorityI(objRainbow, 25);
	Obj_SetRenderPriorityI(objSunshine, 26);
	
	let mx = 0;

	ObjSprite3D_SetSourceDestRect(obj, 0, 0+mx, 512, 512+mx);	
	ObjSprite2D_SetSourceRect(objTWO, 0, 0, 640, 384);
	ObjSprite2D_SetDestCenter(objTWO);
	ObjRender_SetScaleXYZ(objTWO, 2, 1, 0);

	if(weather == 2 || 4)
	{
		ObjSprite2D_SetSourceRect(objRain, 0, 0-mx, 640, 480-mx);
		ObjSprite2D_SetDestCenter(objRain);
		ObjRender_SetPosition(objRain, GetStgFrameWidth/2, GetStgFrameHeight/2, 0);
		ObjRender_SetScaleXYZ(objRain, 1, 1, 0);
	}
	if(weather == 4)
	{
		ObjSprite2D_SetSourceRect(objRainbow, 0, 0, 384, 192);
		ObjSprite2D_SetDestCenter(objRainbow);
		ObjRender_SetPosition(objRainbow, 320, 96, 0);
		ObjSprite2D_SetSourceRect(objSunshine, 0, 0, 256, 256);
		ObjSprite2D_SetDestCenter(objSunshine);
		ObjRender_SetPosition(objSunshine, 128, 128, 0);
	}
	if(weather == 1)
	{
		ObjSprite2D_SetSourceRect(objSunshine, 0, 0, 256, 256);
		ObjSprite2D_SetDestCenter(objSunshine);
		ObjRender_SetPosition(objSunshine, 128, 128, 0);
	}

	ascent(i in 0..90)
	{
		ObjRender_SetAlpha(obj, 25+(i*2.6));
		ObjSprite3D_SetSourceDestRect(obj, 0, 0+mx, 512, 512+mx);
		ObjSprite2D_SetSourceRect(objRain, 0, 0-mx, 640, 480-mx);
		ObjRender_SetAlpha(objTWO, 25+(i*2.6));
		ObjRender_SetAlpha(objRain, 25+(i*2.6));
		ObjRender_SetAlpha(objRainbow, 25+(i*2.6));
		ObjRender_SetAlpha(objSunshine, 25+(i*2.6));
		mx+=2;
		yield;
	}
	
	while(true)
	{
		ObjSprite3D_SetSourceDestRect(obj, 0, 0+mx, 512, 512+mx);
		if(weather == 2 || 4)
		{
			ObjSprite2D_SetSourceRect(objRain, 0, 0-mx, 640, 480-mx);
			ObjSprite2D_SetDestCenter(objRain);
			ObjRender_SetPosition(objRain, GetStgFrameWidth/2, GetStgFrameHeight/2, 0);
			ObjRender_SetScaleXYZ(objRain, 1, 1, 0);
		}
		if(weather == 4)
		{
			ObjSprite2D_SetSourceRect(objRainbow, 0, 0, 384, 192);
			ObjSprite2D_SetDestCenter(objRainbow);
			ObjRender_SetPosition(objRainbow, 320, 96, 0);
			ObjSprite2D_SetSourceRect(objSunshine, 0, 0, 256, 256);
			ObjSprite2D_SetDestCenter(objSunshine);
			ObjRender_SetPosition(objSunshine, 128, 128, 0);
		}
		if(weather == 1)
		{
			ObjSprite2D_SetSourceRect(objSunshine, 0, 0, 256, 256);
			ObjSprite2D_SetDestCenter(objSunshine);
			ObjRender_SetPosition(objSunshine, 128, 128, 0);
		}
		mx+=2;
		yield;
	}
	Obj_Delete(obj);
}

task RenderWeatherText
{
	let objWeatherText = ObjText_Create;
	if(weather == 1)
	{
		ObjText_SetText(objWeatherText, "Sunny: Larger deathbomb window");
	}
	if(weather == 2)
	{
		ObjText_SetText(objWeatherText, "Drizzle: Bombs deal twice as much damage");
	}
	if(weather == 3)
	{
		ObjText_SetText(objWeatherText, "Cloudy: Gets a free bomb");
	}
	if(weather == 4)
	{
		ObjText_SetText(objWeatherText, "Sunshower: No deathbomb window");
	}
	if(weather == 5)
	{
		ObjText_SetText(objWeatherText, "Spring Haze: Shot damage is reduced by a quarter");
	}
	if(weather == 6)
	{
		ObjText_SetText(objWeatherText, "Heavy Fog: Gets a free life");
	}
	ObjText_SetFontType(objWeatherText, "Verdana");
	ObjText_SetFontColorTop(objWeatherText, 255, 255, 255);
	ObjText_SetFontColorBottom(objWeatherText, 65, 65, 255);
	ObjText_SetFontBorderWidth(objWeatherText, 4);
	ObjText_SetFontBorderType(objWeatherText, BORDER_SHADOW);
	ObjText_SetFontBorderColor(objWeatherText, 0, 0, 0);
	ObjText_SetLinePitch(objWeatherText, 4);
	ObjText_SetSidePitch(objWeatherText, 1);
	ObjText_SetFontSize(objWeatherText, 13);
	ObjRender_SetX(objWeatherText, 0);
	ObjRender_SetY(objWeatherText, 20);
	ascent(i in 0..60)
	{
		ObjRender_SetAlpha(objWeatherText, 15+(i*4));
		yield;
	}
}

task SetCutin(path)
{
	let objCutin = ObjPrim_Create(OBJ_SPRITE_2D);
	let imgCutin = path;
	ObjRender_SetBlendType(objCutin, BLEND_ALPHA);
	ObjPrim_SetTexture(objCutin, imgCutin);
	ObjSprite2D_SetSourceRect(objCutin, 0, 0, 275, 266);
	ObjSprite2D_SetDestCenter(objCutin);
	ObjRender_SetX(objCutin, 1100);
	ObjRender_SetY(objCutin, 200);
	ascent(i in 0..60)
	{
		ObjRender_SetX(objCutin, 1100-(i*12));
		yield;
	}
	ascent(i in 0..60)
	{
		ObjRender_SetX(objCutin, 380-(i*2));
		yield;
	}
	ascent(i in 0..60)
	{
		ObjRender_SetAlpha(objCutin, 255-(i*4));
		yield;
	}
	Obj_Delete(objCutin);
}

task SpellBG
{
	let objBossID = ID_INVALID;
	if(length(GetEnemyBossObjectID) >= 1)
	{
		objBossID = GetEnemyBossObjectID[0];
	}

	MagicCircle;
	Timeout;

	let obj2 = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjRender_SetBlendType(obj2, BLEND_ALPHA);
	Obj_SetRenderPriorityI(obj2, 27);
	ObjPrim_SetTexture(obj2, GetCurrentScriptDirectory~"./img/Spellbg TWO.png");
	ObjRender_SetScaleXYZ(obj2, 2, 2, 2);
	ObjSprite2D_SetSourceRect(obj2, 0, 0, 512, 512);
	ObjSprite2D_SetDestRect(obj2, -512, -512, 512, 512);

	let ang = 0;
	let ang2 = 0;
	let ang3 = rand(0,360);
	let x = 0;
	let y = 0;
	let mx = 0;
	let mx2 = 0;
	let alpha = 0;
	loop
	{
		if(!Obj_IsDeleted(objBossID))
		{
			if(alpha < 155)
			{
				alpha += 2;
			}
		}
		else
		{
			alpha = 0;
		}

		ang+=0.5;
		ObjRender_SetAlpha(obj2, alpha);
		ObjRender_SetAngleZ(obj2, -ang);

		ObjRender_SetPosition(obj2, GetStgFrameWidth/2, GetStgFrameHeight/2, 0);
		ObjRender_SetScaleXYZ(obj2, 1, 1, 0);

		ang+=0.5;
		yield;
	}
}

task Timeout
{
	LoadSound(timeout);
	LoadSound(timeout2);
	Blackout;

	while(ObjEnemyBossScene_GetInfo(objScene, INFO_TIMER) >= 10){yield;}
	loop(5)
	{
		PlaySE(timeout);
		wait(60);
	}
	loop(5)
	{
		PlaySE(timeout2);
		wait(60);
	}
}

task Blackout
{
	let objBossID = ID_INVALID;
	if(length(GetEnemyBossObjectID) >= 1)
	{
		objBossID = GetEnemyBossObjectID[0];
	}

	let obj = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjRender_SetBlendType(obj, BLEND_ALPHA);
	Obj_SetRenderPriorityI(obj, 28);
	ObjPrim_SetTexture(obj, GetCurrentScriptDirectory~"./img/Spellbg THREE.png");
	ObjRender_SetScaleXYZ(obj, 2, 2, 2);
	ObjSprite2D_SetSourceRect(obj, 0, 0, 512, 512);
	ObjSprite2D_SetDestRect(obj, -512, -512, 512, 512);
	ObjRender_SetAlpha(obj, 0);

	while(ObjEnemyBossScene_GetInfo(objScene, INFO_TIMER) >= 10){yield;}
	ObjEnemy_AddLife(objBossID, -ObjEnemy_GetInfo(objBoss,INFO_LIFE)+1);
	if(!Obj_IsDeleted(objBossID))
	{
		ascent(i in 0..300)
		{
			ObjRender_SetAlpha(obj, 0+i*0.85);
			ObjEnemy_SetDamageRate(objBossID, 0, 0);
			yield;
		}
		loop(300)
		{
			ObjEnemy_SetDamageRate(objBossID, 0, 0);
			yield;
		}
		ascent(i in 0..60)
		{
			ObjRender_SetAlpha(obj, 255-i*4.25);
			yield;
		}
	}
	Obj_Delete(obj);
}

task MagicCircle {

	let objBossID = ID_INVALID;
	if(length(GetEnemyBossObjectID) >= 1)
	{
		objBossID = GetEnemyBossObjectID[0];
	}

	let countVertex = 64;
	let listRadius = [];
	loop(countVertex) {
		listRadius = listRadius ~ [0];
	}

	let path = GetCurrentScriptDirectory ~ "./img/Default_MagicCircle.png";
	let obj = ObjPrim_Create(OBJ_PRIMITIVE_2D);
	ObjPrim_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
	ObjPrim_SetVertexCount(obj, countVertex);
	ObjRender_SetBlendType(obj, BLEND_ADD_RGB);
	Obj_SetRenderPriority(obj, 0.60);
	ObjPrim_SetTexture(obj, path);
	ascent(iVert in 0..countVertex / 2) {
		let left = iVert * 128;
		let indexVert = iVert * 2;
		ObjPrim_SetVertexUVT(obj, indexVert + 0, left, 0);
		ObjPrim_SetVertexUVT(obj, indexVert + 1, left, 64);		
	}

	let cx = 0;
	let cy = 0;
	let maxRadius = 200;
	let alpha = 0;
	let frame = 0;
	let angleRender = 0;
	let frameInvOld = 0;

	while(!Obj_IsDeleted(objBossID)) {
		let frameInv = ObjEnemyBossScene_GetInfo(objScene, INFO_TIMERF);

		if(frameInv <= 0) {
			Obj_SetVisible(obj, false);
			frameInvOld = 0;
		} else {
			if(frameInvOld == 0) {
				ascent(iVert in 0..countVertex) {
					listRadius[iVert] = 0;
				}
				alpha = 0;
				frame = 0;
			}
			frameInvOld = frameInv;

			let px = ObjMove_GetX(objBoss);
			let py = ObjMove_GetY(objBoss);

			alpha += 1 / 120;
			alpha = min(alpha, 1);
			angleRender += 360 / countVertex / 2;
			Obj_SetVisible(obj, true);

			frameInv = min(600, frameInv);
			let rRate = frameInv / 600;

			ascent(iVert in 0..countVertex / 2) {
				let indexVert = iVert * 2;
				let angle = 360 / (countVertex / 2 - 1) * iVert;

				let vx1 = listRadius[indexVert] * cos(angle);
				let vy1 = listRadius[indexVert] * sin(angle);
				ObjPrim_SetVertexPosition(obj, indexVert + 0, vx1, vy1, 0);

				let vx2 = listRadius[indexVert+1] * cos(angle);
				let vy2 = listRadius[indexVert+1] * sin(angle);
				ObjPrim_SetVertexPosition(obj, indexVert + 1, vx2, vy2, 0);

				if(frame >= 0) {
					let dr = (maxRadius * rRate - listRadius[indexVert]) / 8;
					listRadius[indexVert] = listRadius[indexVert] + dr;
				}
				if(frame > 10) {
					let rRateIn = rRate - 0.12;
					if(rRateIn < 0){rRateIn=0;}
					let dr= (maxRadius * rRateIn - listRadius[indexVert + 1]) / 16;
					listRadius[indexVert + 1] = listRadius[indexVert + 1] + dr;
				}

			}

			ObjRender_SetColor(obj, 192 * alpha, 192 * alpha, 255 * alpha);
			ObjRender_SetPosition(obj, px, py, 0);
			ObjRender_SetAngleZ(obj, angleRender);

			frame++;
		}

		yield;
	}
	Obj_Delete(obj);
}

task SetSpellName(string)
{
	let objBossID = ID_INVALID;
	if(length(GetEnemyBossObjectID) >= 1)
	{
		objBossID = GetEnemyBossObjectID[0];
	}

	let objCutinText = ObjText_Create;
	ObjText_SetText(objCutinText, string);
	ObjText_SetFontType(objCutinText, "Verdana");
	ObjText_SetFontColorTop(objCutinText, 255, 255, 255);
	ObjText_SetFontColorBottom(objCutinText, 255, 65, 65);
	ObjText_SetFontBorderWidth(objCutinText, 4);
	ObjText_SetFontBorderType(objCutinText, BORDER_SHADOW);
	ObjText_SetFontBorderColor(objCutinText, 0, 0, 0);
	ObjText_SetLinePitch(objCutinText, 6);
	ObjText_SetSidePitch(objCutinText, 1);
	ObjRender_SetX(objCutinText, 0);
	ObjRender_SetY(objCutinText, 380);
	ascent(i in 0..60)
	{
		ObjText_SetFontSize(objCutinText, 72-i);
		ObjRender_SetAlpha(objCutinText, 15+(i*4));
		yield;
	}
	wait(60);
	ascent(i in 0..60)
	{
		ObjRender_SetY(objCutinText, 380-(i*5.6));
		yield;
	}

	while(!Obj_IsDeleted(objBossID)){yield;}
	Obj_Delete(objCutinText);
}

task RenderBorderDuel
{
	let objCutin = ObjPrim_Create(OBJ_SPRITE_2D);
	let imgCutin = GetCurrentScriptDirectory ~ "./img/BorderOfDuel.png";
	ObjRender_SetBlendType(objCutin, BLEND_ALPHA);
	ObjPrim_SetTexture(objCutin, imgCutin);
	ObjSprite2D_SetSourceRect(objCutin, 0, 0, 303, 165);
	ObjSprite2D_SetDestCenter(objCutin);
	ObjRender_SetX(objCutin, 320);
	ObjRender_SetY(objCutin, 240);
	ascent(i in 0..30)
	{
		ObjRender_SetScaleX(objCutin, 0+(i/30));
		ObjRender_SetScaleY(objCutin, 0+(i/30));
		yield;
	}
	ascent(i in 0..60)
	{
		ObjRender_SetScaleX(objCutin, 1+(i/400));
		ObjRender_SetScaleY(objCutin, 1+(i/400));
		yield;
	}
	ascent(i in 0..60)
	{
		ObjRender_SetScaleX(objCutin, 1.15+(i/10));
		ObjRender_SetScaleY(objCutin, 1.15+(i/10));
		ObjRender_SetAlpha(objCutin, 255-(i*4));
		yield;
	}
	Obj_Delete(objCutin);
}

task RenderKnockout
{
	if(GetPlayerLife == -1)
	{
		SetPlayerLife(-2);
	}
	PlaySE(finish);
	let objCutin = ObjPrim_Create(OBJ_SPRITE_2D);
	let imgCutin = GetCurrentScriptDirectory ~ "./img/Knockout.png";
	ObjRender_SetBlendType(objCutin, BLEND_ALPHA);
	ObjPrim_SetTexture(objCutin, imgCutin);
	ObjSprite2D_SetSourceRect(objCutin, 0, 0, 218, 183);
	ObjSprite2D_SetDestCenter(objCutin);
	ObjRender_SetX(objCutin, 320);
	ObjRender_SetY(objCutin, 240);
	ascent(i in 0..30)
	{
		ObjRender_SetScaleX(objCutin, 0+(i/30));
		ObjRender_SetScaleY(objCutin, 0+(i/30));
		yield;
	}
	ascent(i in 0..60)
	{
		ObjRender_SetScaleX(objCutin, 1+(i/400));
		ObjRender_SetScaleY(objCutin, 1+(i/400));
		yield;
	}
	ascent(i in 0..60)
	{
		ObjRender_SetScaleX(objCutin, 1.15+(i/10));
		ObjRender_SetScaleY(objCutin, 1.15+(i/10));
		ObjRender_SetAlpha(objCutin, 255-(i*4));
		yield;
	}
	Obj_Delete(objCutin);
}

task RenderDown
{
	PlaySE(finish);
	let objCutin = ObjPrim_Create(OBJ_SPRITE_2D);
	let imgCutin = GetCurrentScriptDirectory ~ "./img/Down.png";
	ObjRender_SetBlendType(objCutin, BLEND_ALPHA);
	ObjPrim_SetTexture(objCutin, imgCutin);
	ObjSprite2D_SetSourceRect(objCutin, 0, 0, 228, 186);
	ObjSprite2D_SetDestCenter(objCutin);
	ObjRender_SetX(objCutin, 320);
	ObjRender_SetY(objCutin, 240);
	ascent(i in 0..30)
	{
		ObjRender_SetScaleX(objCutin, 0+(i/30));
		ObjRender_SetScaleY(objCutin, 0+(i/30));
		yield;
	}
	ascent(i in 0..60)
	{
		ObjRender_SetScaleX(objCutin, 1+(i/400));
		ObjRender_SetScaleY(objCutin, 1+(i/400));
		yield;
	}
	ascent(i in 0..60)
	{
		ObjRender_SetScaleX(objCutin, 1.15+(i/10));
		ObjRender_SetScaleY(objCutin, 1.15+(i/10));
		ObjRender_SetAlpha(objCutin, 255-(i*4));
		yield;
	}
	Obj_Delete(objCutin);
}

task RenderSpellBreak
{
	PlaySE(finish);
	let objCutin = ObjPrim_Create(OBJ_SPRITE_2D);
	let imgCutin = GetCurrentScriptDirectory ~ "./img/SpellBreak.png";
	ObjRender_SetBlendType(objCutin, BLEND_ALPHA);
	ObjPrim_SetTexture(objCutin, imgCutin);
	ObjSprite2D_SetSourceRect(objCutin, 0, 0, 230, 177);
	ObjSprite2D_SetDestCenter(objCutin);
	ObjRender_SetX(objCutin, 320);
	ObjRender_SetY(objCutin, 240);
	ascent(i in 0..30)
	{
		ObjRender_SetScaleX(objCutin, 0+(i/30));
		ObjRender_SetScaleY(objCutin, 0+(i/30));
		yield;
	}
	ascent(i in 0..60)
	{
		ObjRender_SetScaleX(objCutin, 1+(i/400));
		ObjRender_SetScaleY(objCutin, 1+(i/400));
		yield;
	}
	ascent(i in 0..60)
	{
		ObjRender_SetScaleX(objCutin, 1.15+(i/10));
		ObjRender_SetScaleY(objCutin, 1.15+(i/10));
		ObjRender_SetAlpha(objCutin, 255-(i*4));
		yield;
	}
	Obj_Delete(objCutin);
}

task RenderLivesAndBombs
{
	let objText = ObjText_Create;
	ObjText_SetText(objText, "Lives: ");
	ObjText_SetFontType(objText, "Verdana");
	ObjText_SetFontColorTop(objText, 255, 255, 255);
	ObjText_SetFontColorBottom(objText, 255, 65, 255);
	ObjText_SetFontBorderWidth(objText, 4);
	ObjText_SetFontBorderType(objText, BORDER_SHADOW);
	ObjText_SetFontBorderColor(objText, 0, 0, 0);
	ObjText_SetLinePitch(objText, 6);
	ObjText_SetSidePitch(objText, 1);
	ObjRender_SetX(objText, 0);
	ObjRender_SetY(objText, 400);
	ObjText_SetFontSize(objText, 13);

	let objText2 = ObjText_Create;
	ObjText_SetText(objText2, "Bombs: ");
	ObjText_SetFontType(objText2, "Verdana");
	ObjText_SetFontColorTop(objText2, 255, 255, 255);
	ObjText_SetFontColorBottom(objText2, 65, 255, 65);
	ObjText_SetFontBorderWidth(objText2, 4);
	ObjText_SetFontBorderType(objText2, BORDER_SHADOW);
	ObjText_SetFontBorderColor(objText2, 0, 0, 0);
	ObjText_SetLinePitch(objText2, 6);
	ObjText_SetSidePitch(objText2, 1);
	ObjRender_SetX(objText2, 0);
	ObjRender_SetY(objText2, 420);
	ObjText_SetFontSize(objText2, 13);

	loop
	{
		let objText3 = ObjText_Create;
		ObjText_SetText(objText3, IntToString(GetPlayerLife));
		ObjText_SetFontType(objText3, "Verdana");
		ObjText_SetFontColorTop(objText3, 255, 255, 255);
		ObjText_SetFontColorBottom(objText3, 255, 65, 255);
		ObjText_SetFontBorderWidth(objText3, 4);
		ObjText_SetFontBorderType(objText3, BORDER_SHADOW);
		ObjText_SetFontBorderColor(objText3, 0, 0, 0);
		ObjText_SetLinePitch(objText3, 6);
		ObjText_SetSidePitch(objText3, 1);
		ObjRender_SetX(objText3, 90);
		ObjRender_SetY(objText3, 400);
		ObjText_SetFontSize(objText3, 13);

		let objText4 = ObjText_Create;
		ObjText_SetText(objText4, IntToString(GetPlayerSpell));
		ObjText_SetFontType(objText4, "Verdana");
		ObjText_SetFontColorTop(objText4, 255, 255, 255);
		ObjText_SetFontColorBottom(objText4, 65, 255, 65);
		ObjText_SetFontBorderWidth(objText4, 4);
		ObjText_SetFontBorderType(objText4, BORDER_SHADOW);
		ObjText_SetFontBorderColor(objText4, 0, 0, 0);
		ObjText_SetLinePitch(objText4, 6);
		ObjText_SetSidePitch(objText4, 1);
		ObjRender_SetX(objText4, 90);
		ObjRender_SetY(objText4, 420);
		ObjText_SetFontSize(objText4, 13);

		DeletThis(objText3);
		DeletThis(objText4);

		yield;
	}
}

task DeletThis(obj)
{
	wait(1);
	Obj_Delete(obj);
}