function PlaySound(path){
	if(ObjEnemy_GetInfo(objBoss,INFO_LIFE)>0){
		let obj=ObjSound_Create;
		ObjSound_Load(obj,path);
		ObjSound_SetSoundDivision(obj,SOUND_SE);
		ObjSound_Play(obj);
	}
}

function PlaySoundNR(path){
	let obj=ObjSound_Create;
	ObjSound_Load(obj,path);
	ObjSound_SetSoundDivision(obj,SOUND_SE);
	ObjSound_Play(obj);
}

task PlaySoundDelay(path,w){
	wait(w);
	if(ObjEnemy_GetInfo(objBoss,INFO_LIFE)>0){
		let obj=ObjSound_Create;
		ObjSound_Load(obj,path);
		ObjSound_SetSoundDivision(obj,SOUND_SE);
		ObjSound_Play(obj);
	}
}

task TChargeNoSE(x,y){
	if(ObjEnemy_GetInfo(objBoss,INFO_LIFE)>0){
		TChargeCircle(x,y);
		loop(10){
			TChargeEffect(x,y);
			wait(2);
		}
	}
}

task TCharge(x,y){
	if(ObjEnemy_GetInfo(objBoss,INFO_LIFE)>0){
		PlaySound(GCSD~"se/charge00.wav");
		TChargeCircle(x,y);
		loop(10){
			TChargeEffect(x,y);
			wait(2);
		}
	}
}

task TChargeCircle(x,y){
	let img=GCSD~"img/circle.png";
	let obj=ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(obj,img);
	ObjSprite2D_SetSourceRect(obj,0,0,512,512);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetPosition(obj,x,y,0);
	ObjRender_SetBlendType(obj,BLEND_ADD_RGB);
	ObjRender_SetScaleXYZ(obj,0.75,0.75,0);
	let n=60;
	descent(i in 0..n){
		ObjRender_SetScaleXYZ(obj,i/n/1.25,i/n/1.25,0);
		ascent(k in 0..4){
			ObjPrim_SetVertexColor(obj,k,(n-i)/n*255,(n-i)/n*128,(n-i)/n*128);
		}
		yield;
	}
	Obj_Delete(obj);
}

task TChargeEffect(x,y){
	let img=GCSD~"img/leaf.png";
	let obj=ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(obj,img);
	ObjSprite2D_SetSourceRect(obj,0,0,32,32);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetBlendType(obj,BLEND_ADD_RGB);
	let angle=rand(0,360);
	let angle2=rand(0,360);
	let sAngle=rand(-5,5);
	let R=125+rand(-25,25);
	let n=45;
	descent(i in 0..n){
		ObjRender_SetPosition(obj,x+R*(i/n)*cos(angle),y+R*(i/n)*sin(angle),0);
		let size=((i/n*4.5)+((i/n*4.5)/5))/0.75;
		ObjRender_SetScaleXYZ(obj,size,size,size);
		ascent(j in 0..4){
			ObjPrim_SetVertexColor(obj,j,(n-i)/n*255,(n-i)/n*255,(n-i)/n*255);
		}
		ObjRender_SetAngleZ(obj,angle2);
		angle2+=sAngle;
		angle2%=360;
		yield;
	}
	Obj_Delete(obj);
}

task TExplode(x,y){
	if(ObjEnemy_GetInfo(objBoss,INFO_LIFE)>0){
		loop(20){
			TExplodeEffect(x,y);
		}
	}
}

task TExplodeNR(x,y){
	loop(20){
		TExplodeEffect(x,y);
	}
}

task TExplodeEffect(x,y){
	let img=GCSD~"img/leaf.png";
	let obj=ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(obj,img);
	ObjSprite2D_SetSourceRect(obj,0,0,32,32);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetBlendType(obj,BLEND_ADD_RGB);
	let scale=3.5+rand(-1,1);
	ObjRender_SetScaleXYZ(obj,scale,scale,scale);
	let R=0;
	let Ri=rand(6,30)/3;
	let angle=rand(0,360);
	let angle2=rand(0,360);
	let sAngle=rand(-5,5);
	let n=90;
	descent(i in 0..n){
		ObjRender_SetScaleXYZ(obj,scale,scale,scale);
		ObjRender_SetPosition(obj,x+R*cos(angle),y+R*sin(angle),0);
		R+=Ri;
		ascent(j in 0..4){
			ObjPrim_SetVertexColor(obj,j,i/n*255,i/n*255,i/n*255);
		}
		ObjRender_SetAngleZ(obj,angle2);
		angle2+=sAngle;
		angle2%=360;
		Ri-=(Ri/n)/6;
		scale-=(scale/n)/2;
		yield;
	}
	Obj_Delete(obj);
}

let ANIM_IDLE=true;

function TDrawBoss{
	let sPath=GCSD~"img/spellseal.png";
    let objBoss=ObjEnemy_Create(OBJ_ENEMY_BOSS);
    ObjEnemy_Regist(objBoss);
    let img=GCSD~"img/stg4aenm.png";
    ObjPrim_SetTexture(objBoss,img);
	TAnim;
    ObjSprite2D_SetDestCenter(objBoss);
	let objS=FDrawMagicCircle(objBoss,0,0,4,160);
	TCheckForSpell;
	return objBoss;
	while(!Obj_IsDeleted(objBoss)){ yield; }
	Obj_Delete(objS);
	task TAnim{
		let IDLE=[[12,6,51,76],[76,6,115,76],[140,6,179,76],[204,6,243,76]];
		let MOVE=[[10,85,50,157],[65,85,116,157],[130,85,184,157],[194,85,248,157]];
		let MOVE2=[[10,85,50,157],[65,85,116,157],[130,85,184,157],[194,85,248,157]];
		let ATTACK=[[2,166,51,236],[67,166,120,236],[139,166,191,236],[204,165,253,237]];
		while(!Obj_IsDeleted(objBoss)){
			while(ObjMove_GetSpeed(objBoss)==0&&!Obj_IsDeleted(objBoss)&&ANIM_IDLE==true){
				ascent(i in 0..length(IDLE)){
					ObjSprite2D_SetSourceRect(objBoss,IDLE[i][0],IDLE[i][1],IDLE[i][2],IDLE[i][3]);
					ObjSprite2D_SetDestCenter(objBoss);
					Check(ObjMove_GetSpeed(objBoss)==0&&!Obj_IsDeleted(objBoss)&&ANIM_IDLE==true);
					wait(5);
					Check(ObjMove_GetSpeed(objBoss)==0&&!Obj_IsDeleted(objBoss)&&ANIM_IDLE==true);
				}
				if(ANIM_IDLE!=true){ break; }
			}
			while(ObjMove_GetSpeed(objBoss)==0&&!Obj_IsDeleted(objBoss)&&ANIM_IDLE==false){
				ascent(i in 0..length(ATTACK)){
					ObjSprite2D_SetSourceRect(objBoss,ATTACK[i][0],ATTACK[i][1],ATTACK[i][2],ATTACK[i][3]);
					ObjSprite2D_SetDestCenter(objBoss);
					wait(3);
					Check(ObjMove_GetSpeed(objBoss)==0&&!Obj_IsDeleted(objBoss)&&ANIM_IDLE==false);
				}
				ObjSprite2D_SetSourceRect(objBoss,ATTACK[2][0],ATTACK[2][1],ATTACK[2][2],ATTACK[2][3]);
				ObjSprite2D_SetDestCenter(objBoss);
				wait(3);
				Check(ObjMove_GetSpeed(objBoss)==0&&!Obj_IsDeleted(objBoss)&&ANIM_IDLE==false);
				ObjSprite2D_SetSourceRect(objBoss,ATTACK[1][0],ATTACK[1][1],ATTACK[1][2],ATTACK[1][3]);
				ObjSprite2D_SetDestCenter(objBoss);
				wait(3);
				Check(ObjMove_GetSpeed(objBoss)==0&&!Obj_IsDeleted(objBoss)&&ANIM_IDLE==false);
				if(ANIM_IDLE!=false){ break; }
			}
			if(ObjMove_GetSpeed(objBoss)>0&&cos(ObjMove_GetAngle(objBoss))>0&&!Obj_IsDeleted(objBoss)){
				ObjRender_SetAngleY(objBoss,0);
				ascent(i in 0..length(MOVE)){
					ObjSprite2D_SetSourceRect(objBoss,MOVE[i][0],MOVE[i][1],MOVE[i][2],MOVE[i][3]);
					ObjSprite2D_SetDestCenter(objBoss);
					wait(3);
					Check(ObjMove_GetSpeed(objBoss)>0&&cos(ObjMove_GetAngle(objBoss))>0&&!Obj_IsDeleted(objBoss));
				}
				while(ObjMove_GetSpeed(objBoss)>0&&cos(ObjMove_GetAngle(objBoss))>0&&!Obj_IsDeleted(objBoss)){ yield; }
				descent(i in 0..length(MOVE)){
					ObjSprite2D_SetSourceRect(objBoss,MOVE[i][0],MOVE[i][1],MOVE[i][2],MOVE[i][3]);
					ObjSprite2D_SetDestCenter(objBoss);
					wait(3);
					Check(ObjMove_GetSpeed(objBoss)==0&&cos(ObjMove_GetAngle(objBoss))>0&&!Obj_IsDeleted(objBoss));
				}
			}
			if(ObjMove_GetSpeed(objBoss)>0&&cos(ObjMove_GetAngle(objBoss))<0&&!Obj_IsDeleted(objBoss)){
				ObjRender_SetAngleY(objBoss,180);
				ascent(i in 0..length(MOVE2)){
					ObjSprite2D_SetSourceRect(objBoss,MOVE2[i][0],MOVE2[i][1],MOVE2[i][2],MOVE2[i][3]);
					ObjSprite2D_SetDestCenter(objBoss);
					wait(3);
					Check(ObjMove_GetSpeed(objBoss)>0&&cos(ObjMove_GetAngle(objBoss))<0&&!Obj_IsDeleted(objBoss));
				}
				while(ObjMove_GetSpeed(objBoss)>0&&cos(ObjMove_GetAngle(objBoss))<0&&!Obj_IsDeleted(objBoss)){ yield; }
				descent(i in 0..length(MOVE2)){
					ObjSprite2D_SetSourceRect(objBoss,MOVE2[i][0],MOVE2[i][1],MOVE2[i][2],MOVE2[i][3]);
					ObjSprite2D_SetDestCenter(objBoss);
					wait(3);
					Check(ObjMove_GetSpeed(objBoss)==0&&cos(ObjMove_GetAngle(objBoss))<0&&!Obj_IsDeleted(objBoss));
				}
			}
			yield;
		}
	}
	task TCheckForSpell{
		let s=5;
		let sizes=[1.75,2.20];
		ascent(i in 0..length(sizes)){
			TBarrier(sizes[i],s);
			s=-s;
		}
		task TBarrier(size,spint){
			let objScene=GetEnemyBossSceneObjectID();
			let scale=3;
			let oAlpha=0;
			let alpha=255;
			let obj=ObjPrim_Create(OBJ_SPRITE_2D);
			ObjPrim_SetTexture(obj,sPath);
			ObjSprite2D_SetSourceRect(obj,0,0,128,128);
			ObjSprite2D_SetDestCenter(obj);
			ObjRender_SetAlpha(obj,0);
			ObjRender_SetScaleXYZ(obj,scale,scale,0);
			let X=ObjRender_GetX(objBoss);
			let Y=ObjRender_GetY(objBoss);
			TBMove;
			while(!Obj_IsDeleted(objBoss)){
				if(objScene!=ID_INVALID&&ObjEnemyBossScene_GetInfo(objScene,INFO_IS_SPELL)==true&&(IsPlayerSpellActive==true||GetPlayerState==STATE_DOWN)){
					ObjEnemy_SetDamageRate(objBoss,0,0);
					loop(20){
						ascent(i in 0..4){
							ObjPrim_SetVertexAlpha(objBoss,i,alpha);
						}
						ObjRender_SetScaleXYZ(obj,scale,scale,0);
						ObjRender_SetAlpha(obj,oAlpha);
						oAlpha+=128/20;
						alpha-=128/20;
						scale-=size/20;
						yield;
					}
					while((IsPlayerSpellActive==true||GetPlayerState==STATE_DOWN)&&!Obj_IsDeleted(objBoss)&&objScene!=ID_INVALID){
						yield;
					}
					loop(20){
						ascent(i in 0..4){
							ObjPrim_SetVertexAlpha(objBoss,i,alpha);
						}
						ObjRender_SetScaleXYZ(obj,scale,scale,0);
						ObjRender_SetAlpha(obj,oAlpha);
						oAlpha-=128/20;
						alpha+=128/20;
						scale+=size/20;
						yield;
					}
					ObjEnemy_SetDamageRate(objBoss,100,100);
					ObjRender_SetAlpha(obj,0);
					ObjRender_SetScaleXYZ(obj,scale,scale,0);
					alpha=255;
					ObjRender_SetAlpha(objBoss,alpha);
				}
				yield;
				if(ObjEnemy_GetInfo(objBoss,INFO_LIFE)<0||Obj_IsDeleted(objBoss)){ break; }
			}
			Obj_Delete(obj);
			task TBMove{
				let spin=0;
				while(!Obj_IsDeleted(obj)){
					X=ObjRender_GetX(objBoss);
					Y=ObjRender_GetY(objBoss);
					ObjRender_SetPosition(obj,X,Y,0);
					ObjRender_SetAngleXYZ(obj,0,0,spin*spint);
					spin++;
					yield;
				}
			}
		}
	}
}

function Check(x){
	if(x==false){ break; }
}

function FDrawMagicCircle(BOSS,xadd,yadd,zadd,alpha){
	let xspin=0;
	let yspin=0;
	let zspin=0;
	let scale=0;
	let obj=ObjEnemy_Create(OBJ_ENEMY);
	ObjEnemy_Regist(obj);
	let imgFam=GCSD~"img/graphics2.png";
	LoadTexture(imgFam);
	ObjPrim_SetTexture(obj,imgFam);
	ObjSprite2D_SetSourceRect(obj,129,81,256,208);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetPosition(obj,0,0,0);
	ObjRender_SetAlpha(obj,alpha);
	TSpinSize;
	return obj;
	task TSpinSize{
		while(!Obj_IsDeleted(BOSS)){
			ObjRender_SetAngleXYZ(obj,xspin,yspin,zspin);
			xspin+=xadd;
			yspin+=yadd;
			zspin+=zadd;
			let result=sin(scale)/2.5+3.75;
			ObjRender_SetScaleXYZ(obj,result/2,result/2,0);
			scale+=3;
			ObjMove_SetPosition(obj,ObjMove_GetX(BOSS),ObjMove_GetY(BOSS));
			yield;
		}
		Obj_Delete(obj);
	}
}

function DrawFamiliar(x,y,let colour,let health,let clipDeath){
	let obj=ObjEnemy_Create(OBJ_ENEMY);
	ObjEnemy_Regist(obj);
	let imgFam=GCSD~"img/familiar.png";
	LoadTexture(imgFam);
	ObjPrim_SetTexture(obj,imgFam);
	ObjSprite2D_SetSourceRect(obj,0,0,65,65);
	ObjSprite2D_SetDestCenter(obj);
	ObjRender_SetPosition(obj,x,y,0);
	
	let obj_focus=ObjEnemy_Create(OBJ_ENEMY);
	ObjEnemy_Regist(obj_focus);
	let imgFocus=GCSD~"img/enemy.png";
	LoadTexture(imgFocus);
	ObjPrim_SetTexture(obj_focus,imgFocus);
	alternative(colour)
	case("RED"){
		ObjSprite2D_SetSourceRect(obj_focus,1,193,30,222);
	}
	case("GREEN"){
		ObjSprite2D_SetSourceRect(obj_focus,33,193,62,222);
	}
	case("BLUE"){
		ObjSprite2D_SetSourceRect(obj_focus,65,193,94,222);
	}
	case("MAGENTA"){
		ObjSprite2D_SetSourceRect(obj_focus,97,193,126,222);
	}
	ObjSprite2D_SetDestCenter(obj_focus);
	ObjRender_SetPosition(obj_focus,x,y,0);
	let shift=1;
	ObjRender_SetAlpha(obj,255);
	ObjRender_SetAlpha(obj_focus,0);
	if(health==true){
		ObjEnemy_SetLife(obj,25);
	}else{
		ObjEnemy_SetLife(obj,9999999);
	}
	let alpha=255;
	let alpha_f=0;
	TAlpha;
	TPos;
	return obj;
	task TAlpha{
		while(!Obj_IsDeleted(objBoss)&&ObjEnemy_GetInfo(obj,INFO_LIFE)>0){
			if(GetVirtualKeyState(VK_SLOWMOVE)==KEY_FREE&&shift==1){
				loop(10){
					alpha-=255/10;
					alpha_f+=255/10;
					ObjRender_SetAlpha(obj,alpha);
					ObjRender_SetAlpha(obj_focus,alpha_f);
					yield;
				}
				shift++;
			}
			if(GetVirtualKeyState(VK_SLOWMOVE)==KEY_HOLD&&shift==2){
				loop(10){
					alpha+=255/10;
					alpha_f-=255/10;
					ObjRender_SetAlpha(obj,alpha);
					ObjRender_SetAlpha(obj_focus,alpha_f);
					yield;
				}
				shift--;
			}
			yield;
		}
	}
	task TPos{
		let DELETE_TYPE=2;
		let spin=0;
		while(!Obj_IsDeleted(objBoss)&&ObjEnemy_GetInfo(obj,INFO_LIFE)>0){
			ObjMove_SetPosition(obj_focus,ObjMove_GetX(obj),ObjMove_GetY(obj));
			spin+=4;
			ObjRender_SetAngleZ(obj,spin);
			ObjRender_SetAngleZ(obj_focus,-spin*2);
			if(GetVirtualKeyState(VK_SLOWMOVE)==KEY_FREE&&shift==2){
				ObjEnemy_SetIntersectionCircleToPlayer(obj,ObjMove_GetX(obj),ObjMove_GetY(obj),14);
				if(health==true){
					ObjEnemy_SetIntersectionCircleToShot(obj,ObjMove_GetX(obj),ObjMove_GetY(obj),14);
				}
			}
			if(GetVirtualKeyState(VK_SLOWMOVE)==KEY_FREE&&shift==1){
				ObjEnemy_SetIntersectionCircleToPlayer(obj,ObjMove_GetX(obj),ObjMove_GetY(obj),0);
				if(health==true){
					ObjEnemy_SetIntersectionCircleToShot(obj,ObjMove_GetX(obj),ObjMove_GetY(obj),0);
				}
			}
			if(clipDeath==true){
				if(ObjMove_GetX(obj)<=-32||ObjMove_GetX(obj)>=GetStgFrameWidth+32||ObjMove_GetY(obj)<=-32||ObjMove_GetY(obj)>=GetStgFrameHeight+32){
					DELETE_TYPE=1;
					break;
				}
			}
			yield;
		}
		if(DELETE_TYPE!=1){
			TExplosionA(ObjMove_GetX(obj),ObjMove_GetY(obj),22.5,0.3);
		}
		Obj_Delete(obj);
		Obj_Delete(obj_focus);
	}
}
					

task Cutin(obj,text){
	PlaySound(GCSD~"se/cardcall.wav");
	let alpha=0;
	let x=GetStgFrameWidth-275;
	let objTxt=ObjText_Create;
	ObjText_SetText(objTxt,text);
	ObjText_SetFontSize(objTxt,13);
	ObjText_SetFontColorTop(objTxt,255,255,255);
	ObjText_SetFontColorBottom(objTxt,255,32,32);
	ObjText_SetFontBorderType(objTxt,BORDER_FULL);
	ObjText_SetFontBorderColor(objTxt,0,0,0);
	ObjText_SetFontBorderWidth(objTxt,1);
	ObjText_SetHorizontalAlignment(objTxt,ALIGNMENT_LEFT);
	ObjText_SetMaxWidth(objTxt,380);
	Obj_SetRenderPriority(objTxt,0.8);
	ObjRender_SetPosition(objTxt,x,GetStgFrameHeight-200,0);
//	ObjText_SetAutoTransCenter(objTxt,true);
	ObjRender_SetAlpha(objTxt,0);
	
	let path=GCSD~"img/reimuhakurei.png";
	let cut=ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(cut,path);
	ObjSprite2D_SetSourceRect(cut,0,0,502,493);
    ObjSprite2D_SetDestCenter(cut);
	ObjRender_SetPosition(cut,-128,GetStgFrameHeight/3*1.75,0);
	Obj_SetRenderPriority(cut,0.78);
	ObjRender_SetScaleXYZ(cut,0.5,0.5,0.5);
	TMove;
	TCut;
	TImage;
	let dir=2;
	ascent(x in -4..4){
		ascent(y in -5..5){
			TText(431*0.75*x,250+(34*y),dir);
			dir=-dir;
		}
	}
	task TMove{
		let n=45;
		descent(i in 0..n){
			alpha+=255/n;
			x-=i/n*4.37;
			ObjRender_SetX(objTxt,x);
			ObjRender_SetAlpha(objTxt,alpha);
			yield;
		}
		wait(15);
		n=30;
		let y=GetStgFrameHeight-200;
		ascent(i in 0..n){
			y-=i/n*7.2;
			ObjRender_SetY(objTxt,y);
			yield;
		}
		descent(i in 0..n){
			y-=i/n*7.2;
			ObjRender_SetY(objTxt,y);
			yield;
		}
		while(!Obj_IsDeleted(obj)){yield;}
		let yscale=1;
		loop(45){
			alpha-=(255/45);
			yscale+=(3/45);
			ObjRender_SetAlpha(objTxt,alpha);
			ObjRender_SetScaleXYZ(objTxt,yscale,yscale,1);
			yield;
		}
		Obj_Delete(objTxt);
	}
	task TCut{
		let n=25;
		let cX=-128;
		descent(i in 1..n){
			cX+=i/n*29;
			ObjRender_SetX(cut,cX);
			yield;
		}
		let D=GetDistance(ObjRender_GetX(cut)+(502/3),ObjRender_GetY(cut),GetStgFrameWidth,ObjRender_GetY(cut));
		loop(36){
			cX+=D/36;
			ObjRender_SetX(cut,cX);
			yield;
		}
		n=15;
		let xS=0.5;
		let yS=0.5;
		ascent(i in 0..n){
			xS+=i/n/45;
			yS-=i/n/15;
			ObjRender_SetScaleX(cut,xS);
			ObjRender_SetScaleY(cut,yS);
			yield;
		}
		Obj_Delete(cut);
	}
	task TImage{
		let alpha2=0;
		let scale2=4;
		let yscale2=1;
		let ypos2=ObjRender_GetY(objTxt)-5;
		let objI=ObjPrim_Create(OBJ_SPRITE_2D);
		let pathI=GCSD~"img/cut.png";
		ObjPrim_SetTexture(objI,pathI);
		ObjSprite2D_SetSourceRect(objI,119,3,383,60);
		ObjSprite2D_SetDestCenter(objI);
		Obj_SetRenderPriority(objI,0.79);
		ObjRender_SetPosition(objI,ObjRender_GetX(objTxt)+125,ObjRender_GetY(objTxt)-3,0);
		ObjRender_SetAlpha(objI,255);
		SetColor(objI,"RED","NORMAL");
		while(!Obj_IsDeleted(obj)){
			ObjRender_SetPosition(objI,ObjRender_GetX(objTxt)+125,ObjRender_GetY(objTxt)-3,0);
			yield;
		}
		loop(45){
			alpha2-=(255/45);
			yscale2+=(3/45);
			ObjRender_SetAlpha(objI,alpha2);
			ObjRender_SetScaleXYZ(objI,yscale2,yscale2,1);
			yield;
		}
		Obj_Delete(objI);
	}
	task TText(x,y,s){
		let alpha=0;
		let objT=ObjPrim_Create(OBJ_SPRITE_2D);
		let pathT=GCSD~"img/cuttext.png";
		ObjPrim_SetTexture(objT,pathT);
		ObjSprite2D_SetSourceRect(objT,0,1,431,35);
		ObjSprite2D_SetDestCenter(objT);
		Obj_SetRenderPriority(objT,0.77);
		ObjRender_SetPosition(objT,x,y,0);
		ObjRender_SetAlpha(objT,0);
		ObjRender_SetScaleXYZ(objT,0.5,0.5,1);
		TMove;
		loop(30){
			ObjRender_SetAlpha(objT,alpha);
			alpha+=128/30;
			yield;
		}
		ObjRender_SetAlpha(objT,192);
		wait(45);
		loop(60){
			ObjRender_SetAlpha(objT,alpha);
			alpha-=128/30;
			yield;
		}
		ObjRender_SetAlpha(objT,0);
		Obj_Delete(objT);
		task TMove{
		 let speed=s;
			while(!Obj_IsDeleted(objT)){
				ObjRender_SetPosition(objT,x+speed,y,0);
				speed+=s;
				yield;
			}
		}
	}
}

function SetColor(obj,c,b){
	let colour=GetRGB(c,b);
	ObjRender_SetColor(obj,colour[0],colour[1],colour[2]);
}

function GetRGB(let color,let brightness){
		alternative(color)
		case("RED") {
			alternative(brightness)
			case("NORMAL") { return [255, 51, 51]; }
			case("DARK") { return [255, 0, 0]; }
			case("BRIGHT") { return [255, 102, 102]; }
		}
		case("ORANGE") {
			alternative(brightness)
			case("NORMAL") { return [255, 153, 51]; }
			case("DARK") { return [255, 128, 0]; }
			case("BRIGHT") { return [255, 178, 102]; }
		}
		case("YELLOW") {
			alternative(brightness)
			case("NORMAL") { return [255, 255, 51]; }
			case("DARK") { return [255, 255, 0]; }
			case("BRIGHT") { return [255, 255, 102]; }
		}
		case("LIME") {
			alternative(brightness)
			case("NORMAL") { return [153, 255, 51]; }
			case("DARK") { return [128, 255, 0]; }
			case("BRIGHT") { return [178, 255, 102]; }
		}
		case("GREEN") {
			alternative(brightness)
			case("NORMAL") { return [153, 255, 153]; }
			case("DARK") { return [0, 255, 0]; }
			case("BRIGHT") { return [102, 255, 102]; }
		}
		case("MINT","TEAL") {
			alternative(brightness)
			case("NORMAL") { return [51, 255, 153]; }
			case("DARK") { return [0, 255, 128]; }
			case("BRIGHT") { return [102, 255, 178]; }
		}
		case("SKY","AQUA") {
			alternative(brightness)
			case("NORMAL") { return [51, 255, 255]; }
			case("DARK") { return [0, 255, 255]; }
			case("BRIGHT") { return [102, 255, 255]; }
		}
		case("BLUE") {
			alternative(brightness)
			case("NORMAL") { return [51, 153, 255]; }
			case("DARK") { return [0, 128, 255]; }
			case("BRIGHT") { return [102, 178, 255]; }
		}
		case("NAVY","INDIGO") {
			alternative(brightness)
			case("NORMAL") { return [51, 51, 255]; }
			case("DARK") { return [0, 0, 255]; }
			case("BRIGHT") { return [102, 102, 255]; }
		}
		case("PURPLE") {
			alternative(brightness)
			case("NORMAL") { return [153, 51, 255]; }
			case("DARK") { return [128, 0, 255]; }
			case("BRIGHT") { return [178, 102, 255]; }
		}
		case("VIOLET","MAGENTA") {
			alternative(brightness)
			case("NORMAL") { return [255, 51, 255]; }
			case("DARK") { return [255, 0, 255]; }
			case("BRIGHT") { return [255, 102, 255]; }
		}
		case("FUSCHIA","ROSE") {
			alternative(brightness)
			case("NORMAL") { return [255, 51, 153]; }
			case("DARK") { return [255, 0, 128]; }
			case("BRIGHT") { return [255, 102, 178]; }
		}
}