if(guiloaded==false){

CreateEnemyFromFile("script\Functions\loadstage.txt",0,0,0,0,0);

	boss1=(Obj_Create(OBJ_EFFECT));
	Obj_SetPosition(boss1,cx,miny-50); ObjEffect_SetScale(boss1,0,0);
	ObjEffect_SetLayer(boss1,3); ObjEffect_SetTexture(boss1,GRtomoko); ObjEffect_SetRenderState(boss1,ALPHA);
	ObjEffect_SetPrimitiveType(boss1,PRIMITIVE_TRIANGLESTRIP); ObjEffect_CreateVertex(boss1,4);
	ObjEffect_SetVertexXY(boss1,0,-64,-64); ObjEffect_SetVertexUV(boss1,0,0,0);
	ObjEffect_SetVertexXY(boss1,1,64,-64); ObjEffect_SetVertexUV(boss1,1,128,0);
	ObjEffect_SetVertexXY(boss1,2,-64,64); ObjEffect_SetVertexUV(boss1,2,0,128);
	ObjEffect_SetVertexXY(boss1,3,64,64); ObjEffect_SetVertexUV(boss1,3,128,128);
	ObjEffect_SetVertexColor(boss1,0,255,255,255,255); ObjEffect_SetVertexColor(boss1,1,255,255,255,255);
	ObjEffect_SetVertexColor(boss1,2,255,255,255,255); ObjEffect_SetVertexColor(boss1,3,255,255,255,255);

	boss2=(Obj_Create(OBJ_EFFECT));
	Obj_SetPosition(boss2,cx,miny-50); ObjEffect_SetScale(boss2,0,0);
	ObjEffect_SetLayer(boss2,3); ObjEffect_SetTexture(boss2,GRsetsuko); ObjEffect_SetRenderState(boss2,ALPHA);
	ObjEffect_SetPrimitiveType(boss2,PRIMITIVE_TRIANGLESTRIP); ObjEffect_CreateVertex(boss2,4);
	ObjEffect_SetVertexXY(boss2,0,-64,-64); ObjEffect_SetVertexUV(boss2,0,0,0);
	ObjEffect_SetVertexXY(boss2,1,64,-64); ObjEffect_SetVertexUV(boss2,1,128,0);
	ObjEffect_SetVertexXY(boss2,2,-64,64); ObjEffect_SetVertexUV(boss2,2,0,128);
	ObjEffect_SetVertexXY(boss2,3,64,64); ObjEffect_SetVertexUV(boss2,3,128,128);
	ObjEffect_SetVertexColor(boss2,0,255,255,255,255); ObjEffect_SetVertexColor(boss2,1,255,255,255,255);
	ObjEffect_SetVertexColor(boss2,2,255,255,255,255); ObjEffect_SetVertexColor(boss2,3,255,255,255,255);

	EFpowerbar3=(Obj_Create(OBJ_EFFECT));
	Obj_SetPosition(EFpowerbar3,460,370);ObjEffect_SetScale(EFpowerbar3,1,1);
	ObjEffect_SetLayer(EFpowerbar3,8); ObjEffect_SetTexture(EFpowerbar3,GRpowerbar);
	ObjEffect_SetPrimitiveType(EFpowerbar3,PRIMITIVE_TRIANGLESTRIP); ObjEffect_CreateVertex(EFpowerbar3,4);
	ObjEffect_SetVertexXY(EFpowerbar3,0,-50,-120); ObjEffect_SetVertexUV(EFpowerbar3,0,100,0);
	ObjEffect_SetVertexXY(EFpowerbar3,1,50,-120); ObjEffect_SetVertexUV(EFpowerbar3,1,200,0);
	ObjEffect_SetVertexXY(EFpowerbar3,2,-50,110); ObjEffect_SetVertexUV(EFpowerbar3,2,100,220);
	ObjEffect_SetVertexXY(EFpowerbar3,3,50,110); ObjEffect_SetVertexUV(EFpowerbar3,3,200,220);
	ObjEffect_SetVertexColor(EFpowerbar3,0,255,255,255,255); ObjEffect_SetVertexColor(EFpowerbar3,1,255,255,255,255);
	ObjEffect_SetVertexColor(EFpowerbar3,2,255,255,255,255); ObjEffect_SetVertexColor(EFpowerbar3,3,255,255,255,255);
}

//Will this reset the frame if it suddenly vanishes? I hope so. Otherwise Danmakufu sucks :<
if(Obj_BeDeleted(framework)==true || guiloaded==false){
	EFpowerbar2=(Obj_Create(OBJ_EFFECT));
	Obj_SetPosition(EFpowerbar2,460,350); ObjEffect_SetScale(EFpowerbar2,1,1);
	ObjEffect_SetLayer(EFpowerbar2,8); ObjEffect_SetTexture(EFpowerbar2,GRpowerbar);
	ObjEffect_SetPrimitiveType(EFpowerbar2,PRIMITIVE_TRIANGLESTRIP); ObjEffect_CreateVertex(EFpowerbar2,4);
	ObjEffect_SetVertexXY(EFpowerbar2,0,-50,-80); ObjEffect_SetVertexUV(EFpowerbar2,0,100,20);
	ObjEffect_SetVertexXY(EFpowerbar2,1,50,-80); ObjEffect_SetVertexUV(EFpowerbar2,1,200,20);
	ObjEffect_SetVertexXY(EFpowerbar2,2,-50,80); ObjEffect_SetVertexUV(EFpowerbar2,2,100,180);
	ObjEffect_SetVertexXY(EFpowerbar2,3,50,80); ObjEffect_SetVertexUV(EFpowerbar2,3,200,180);
	ObjEffect_SetVertexColor(EFpowerbar2,0,255,255,255,255); ObjEffect_SetVertexColor(EFpowerbar2,1,255,255,255,255);
	ObjEffect_SetVertexColor(EFpowerbar2,2,255,255,255,255); ObjEffect_SetVertexColor(EFpowerbar2,3,255,255,255,255);

	EFpowerbar1=(Obj_Create(OBJ_EFFECT));
	Obj_SetPosition(EFpowerbar1,460,360); ObjEffect_SetScale(EFpowerbar1,1,1);
	ObjEffect_SetLayer(EFpowerbar1,8); ObjEffect_SetTexture(EFpowerbar1,GRpowerbar);
	ObjEffect_SetPrimitiveType(EFpowerbar1,PRIMITIVE_TRIANGLESTRIP); ObjEffect_CreateVertex(EFpowerbar1,4);
	ObjEffect_SetVertexXY(EFpowerbar1,0,-50,-110); ObjEffect_SetVertexUV(EFpowerbar1,0,0,0);
	ObjEffect_SetVertexXY(EFpowerbar1,1,50,-110); ObjEffect_SetVertexUV(EFpowerbar1,1,100,0);
	ObjEffect_SetVertexXY(EFpowerbar1,2,-50,110); ObjEffect_SetVertexUV(EFpowerbar1,2,0,220);
	ObjEffect_SetVertexXY(EFpowerbar1,3,50,110); ObjEffect_SetVertexUV(EFpowerbar1,3,100,220);
	ObjEffect_SetVertexColor(EFpowerbar1,0,255,255,255,255); ObjEffect_SetVertexColor(EFpowerbar1,1,255,255,255,255);
	ObjEffect_SetVertexColor(EFpowerbar1,2,255,255,255,255); ObjEffect_SetVertexColor(EFpowerbar1,3,255,255,255,255);
	
	framework=(Obj_Create(OBJ_EFFECT));
	Obj_SetPosition(framework,320,240);
	ObjEffect_SetLayer(framework,8); ObjEffect_SetTexture(framework,GRframe1); ObjEffect_SetRenderState(framework,ALPHA);
	ObjEffect_SetPrimitiveType(framework,PRIMITIVE_TRIANGLESTRIP); ObjEffect_CreateVertex(framework,4);
	ObjEffect_SetVertexXY(framework,0,-320,-240); ObjEffect_SetVertexUV(framework,0,0,0);
	ObjEffect_SetVertexXY(framework,1,320,-240); ObjEffect_SetVertexUV(framework,1,640,0);
	ObjEffect_SetVertexXY(framework,2,-320,240); ObjEffect_SetVertexUV(framework,2,0,480);
	ObjEffect_SetVertexXY(framework,3,320,240); ObjEffect_SetVertexUV(framework,3,640,480);
	ObjEffect_SetVertexColor(framework,0,255,255,255,255); ObjEffect_SetVertexColor(framework,1,255,255,255,255);
	ObjEffect_SetVertexColor(framework,2,255,255,255,255); ObjEffect_SetVertexColor(framework,3,255,255,255,255);

loop(9){
	framelives=(Obj_Create(OBJ_EFFECT));
	Obj_SetPosition(framelives,cx,cy);
	ObjEffect_SetLayer(framelives,8); ObjEffect_SetTexture(framelives,GRframe2); ObjEffect_SetRenderState(framelives,ALPHA);
	ObjEffect_SetPrimitiveType(framelives,PRIMITIVE_TRIANGLESTRIP); ObjEffect_CreateVertex(framelives,4);
	ObjEffect_SetVertexXY(framelives,0,-11,-11); ObjEffect_SetVertexUV(framelives,0,0,0);
	ObjEffect_SetVertexXY(framelives,1,11,-11); ObjEffect_SetVertexUV(framelives,1,22,0);
	ObjEffect_SetVertexXY(framelives,2,-11,11); ObjEffect_SetVertexUV(framelives,2,0,22);
	ObjEffect_SetVertexXY(framelives,3,11,11); ObjEffect_SetVertexUV(framelives,3,22,22);
	ObjEffect_SetVertexColor(framelives,0,255,255,255,255); ObjEffect_SetVertexColor(framelives,1,255,255,255,255);
	ObjEffect_SetVertexColor(framelives,2,255,255,255,255); ObjEffect_SetVertexColor(framelives,3,255,255,255,255);
	lifecounter=lifecounter~[framelives];
}
loop(3){
	framepower=(Obj_Create(OBJ_EFFECT));
	Obj_SetPosition(framepower,cx,cy);
	ObjEffect_SetLayer(framepower,8); ObjEffect_SetTexture(framepower,GRframe2); ObjEffect_SetRenderState(framepower,ALPHA);
	ObjEffect_SetPrimitiveType(framepower,PRIMITIVE_TRIANGLESTRIP); ObjEffect_CreateVertex(framepower,4);
	ObjEffect_SetVertexXY(framepower,0,-7,-8); ObjEffect_SetVertexUV(framepower,0,0,24);
	ObjEffect_SetVertexXY(framepower,1,7,-8); ObjEffect_SetVertexUV(framepower,1,14,24);
	ObjEffect_SetVertexXY(framepower,2,-7,8); ObjEffect_SetVertexUV(framepower,2,0,40);
	ObjEffect_SetVertexXY(framepower,3,7,8); ObjEffect_SetVertexUV(framepower,3,14,40);
	ObjEffect_SetVertexColor(framepower,0,255,255,255,255); ObjEffect_SetVertexColor(framepower,1,255,255,255,255);
	ObjEffect_SetVertexColor(framepower,2,255,255,255,255); ObjEffect_SetVertexColor(framepower,3,255,255,255,255);
	powercounter=powercounter~[framepower];
}
loop(3){
	framemaxpower=(Obj_Create(OBJ_EFFECT));
	Obj_SetPosition(framemaxpower,cx,cy);
	ObjEffect_SetLayer(framemaxpower,8); ObjEffect_SetTexture(framemaxpower,GRframe2); ObjEffect_SetRenderState(framemaxpower,ALPHA);
	ObjEffect_SetPrimitiveType(framemaxpower,PRIMITIVE_TRIANGLESTRIP); ObjEffect_CreateVertex(framemaxpower,4);
	ObjEffect_SetVertexXY(framemaxpower,0,-7,-8); ObjEffect_SetVertexUV(framemaxpower,0,0,24);
	ObjEffect_SetVertexXY(framemaxpower,1,7,-8); ObjEffect_SetVertexUV(framemaxpower,1,14,24);
	ObjEffect_SetVertexXY(framemaxpower,2,-7,8); ObjEffect_SetVertexUV(framemaxpower,2,0,40);
	ObjEffect_SetVertexXY(framemaxpower,3,7,8); ObjEffect_SetVertexUV(framemaxpower,3,14,40);
	ObjEffect_SetVertexColor(framemaxpower,0,255,255,255,255); ObjEffect_SetVertexColor(framemaxpower,1,255,255,255,255);
	ObjEffect_SetVertexColor(framemaxpower,2,255,255,255,255); ObjEffect_SetVertexColor(framemaxpower,3,255,255,255,255);
	maxpowercounter=maxpowercounter~[framemaxpower];
}
loop(8){
	framebombs=(Obj_Create(OBJ_EFFECT));
	Obj_SetPosition(framebombs,cx,cy);
	ObjEffect_SetLayer(framebombs,8); ObjEffect_SetTexture(framebombs,GRframe2); ObjEffect_SetRenderState(framebombs,ALPHA);
	ObjEffect_SetPrimitiveType(framebombs,PRIMITIVE_TRIANGLESTRIP); ObjEffect_CreateVertex(framebombs,4);
	ObjEffect_SetVertexXY(framebombs,0,-13,-11); ObjEffect_SetVertexUV(framebombs,0,23,0);
	ObjEffect_SetVertexXY(framebombs,1,13,-11); ObjEffect_SetVertexUV(framebombs,1,48,0);
	ObjEffect_SetVertexXY(framebombs,2,-13,11); ObjEffect_SetVertexUV(framebombs,2,23,22);
	ObjEffect_SetVertexXY(framebombs,3,13,11); ObjEffect_SetVertexUV(framebombs,3,48,22);
	ObjEffect_SetVertexColor(framebombs,0,255,255,255,255); ObjEffect_SetVertexColor(framebombs,1,255,255,255,255);
	ObjEffect_SetVertexColor(framebombs,2,255,255,255,255); ObjEffect_SetVertexColor(framebombs,3,255,255,255,255);
	bombcounter=bombcounter~[framebombs];
}
loop(4){
	framepoints=(Obj_Create(OBJ_EFFECT));
	Obj_SetPosition(framepoints,cx,cy);
	ObjEffect_SetLayer(framepoints,8); ObjEffect_SetTexture(framepoints,GRframe2); ObjEffect_SetRenderState(framepoints,ALPHA);
	ObjEffect_SetPrimitiveType(framepoints,PRIMITIVE_TRIANGLESTRIP); ObjEffect_CreateVertex(framepoints,4);
	ObjEffect_SetVertexXY(framepoints,0,-7,-8); ObjEffect_SetVertexUV(framepoints,0,0,24);
	ObjEffect_SetVertexXY(framepoints,1,7,-8); ObjEffect_SetVertexUV(framepoints,1,14,24);
	ObjEffect_SetVertexXY(framepoints,2,-7,8); ObjEffect_SetVertexUV(framepoints,2,0,40);
	ObjEffect_SetVertexXY(framepoints,3,7,8); ObjEffect_SetVertexUV(framepoints,3,14,40);
	ObjEffect_SetVertexColor(framepoints,0,255,255,255,255); ObjEffect_SetVertexColor(framepoints,1,255,255,255,255);
	ObjEffect_SetVertexColor(framepoints,2,255,255,255,255); ObjEffect_SetVertexColor(framepoints,3,255,255,255,255);
	pointcounter=pointcounter~[framepoints];
}
loop(4){
	framemaxpoints=(Obj_Create(OBJ_EFFECT));
	Obj_SetPosition(framemaxpoints,cx,cy);
	ObjEffect_SetLayer(framemaxpoints,8); ObjEffect_SetTexture(framemaxpoints,GRframe2); ObjEffect_SetRenderState(framemaxpoints,ALPHA);
	ObjEffect_SetPrimitiveType(framemaxpoints,PRIMITIVE_TRIANGLESTRIP); ObjEffect_CreateVertex(framemaxpoints,4);
	ObjEffect_SetVertexXY(framemaxpoints,0,-7,-8); ObjEffect_SetVertexUV(framemaxpoints,0,0,24);
	ObjEffect_SetVertexXY(framemaxpoints,1,7,-8); ObjEffect_SetVertexUV(framemaxpoints,1,14,24);
	ObjEffect_SetVertexXY(framemaxpoints,2,-7,8); ObjEffect_SetVertexUV(framemaxpoints,2,0,40);
	ObjEffect_SetVertexXY(framemaxpoints,3,7,8); ObjEffect_SetVertexUV(framemaxpoints,3,14,40);
	ObjEffect_SetVertexColor(framemaxpoints,0,255,255,255,255); ObjEffect_SetVertexColor(framemaxpoints,1,255,255,255,255);
	ObjEffect_SetVertexColor(framemaxpoints,2,255,255,255,255); ObjEffect_SetVertexColor(framemaxpoints,3,255,255,255,255);
	maxpointcounter=maxpointcounter~[framemaxpoints];
}
loop(4){
	framegraze=(Obj_Create(OBJ_EFFECT));
	Obj_SetPosition(framegraze,cx,cy);
	ObjEffect_SetLayer(framegraze,8); ObjEffect_SetTexture(framegraze,GRframe2); ObjEffect_SetRenderState(framegraze,ALPHA);
	ObjEffect_SetPrimitiveType(framegraze,PRIMITIVE_TRIANGLESTRIP); ObjEffect_CreateVertex(framegraze,4);
	ObjEffect_SetVertexXY(framegraze,0,-7,-8); ObjEffect_SetVertexUV(framegraze,0,0,24);
	ObjEffect_SetVertexXY(framegraze,1,7,-8); ObjEffect_SetVertexUV(framegraze,1,14,24);
	ObjEffect_SetVertexXY(framegraze,2,-7,8); ObjEffect_SetVertexUV(framegraze,2,0,40);
	ObjEffect_SetVertexXY(framegraze,3,7,8); ObjEffect_SetVertexUV(framegraze,3,14,40);
	ObjEffect_SetVertexColor(framegraze,0,255,255,255,255); ObjEffect_SetVertexColor(framegraze,1,255,255,255,255);
	ObjEffect_SetVertexColor(framegraze,2,255,255,255,255); ObjEffect_SetVertexColor(framegraze,3,255,255,255,255);
	grazecounter=grazecounter~[framegraze];
}
loop(12){
	framescore=(Obj_Create(OBJ_EFFECT));
	Obj_SetPosition(framescore,cx,cy);
	ObjEffect_SetLayer(framescore,8); ObjEffect_SetTexture(framescore,GRframe2); ObjEffect_SetRenderState(framescore,ALPHA);
	ObjEffect_SetPrimitiveType(framescore,PRIMITIVE_TRIANGLESTRIP); ObjEffect_CreateVertex(framescore,4);
	ObjEffect_SetVertexXY(framescore,0,-7,-8); ObjEffect_SetVertexUV(framescore,0,0,24);
	ObjEffect_SetVertexXY(framescore,1,7,-8); ObjEffect_SetVertexUV(framescore,1,14,24);
	ObjEffect_SetVertexXY(framescore,2,-7,8); ObjEffect_SetVertexUV(framescore,2,0,40);
	ObjEffect_SetVertexXY(framescore,3,7,8); ObjEffect_SetVertexUV(framescore,3,14,40);
	ObjEffect_SetVertexColor(framescore,0,255,255,255,255); ObjEffect_SetVertexColor(framescore,1,255,255,255,255);
	ObjEffect_SetVertexColor(framescore,2,255,255,255,255); ObjEffect_SetVertexColor(framescore,3,255,255,255,255);
	scorecounter=scorecounter~[framescore];
}
loop(12){
	framehighscore=(Obj_Create(OBJ_EFFECT));
	Obj_SetPosition(framehighscore,cx,cy);
	ObjEffect_SetLayer(framehighscore,8); ObjEffect_SetTexture(framehighscore,GRframe2); ObjEffect_SetRenderState(framehighscore,ALPHA);
	ObjEffect_SetPrimitiveType(framehighscore,PRIMITIVE_TRIANGLESTRIP); ObjEffect_CreateVertex(framehighscore,4);
	ObjEffect_SetVertexXY(framehighscore,0,-7,-8); ObjEffect_SetVertexUV(framehighscore,0,0,24);
	ObjEffect_SetVertexXY(framehighscore,1,7,-8); ObjEffect_SetVertexUV(framehighscore,1,14,24);
	ObjEffect_SetVertexXY(framehighscore,2,-7,8); ObjEffect_SetVertexUV(framehighscore,2,0,40);
	ObjEffect_SetVertexXY(framehighscore,3,7,8); ObjEffect_SetVertexUV(framehighscore,3,14,40);
	ObjEffect_SetVertexColor(framehighscore,0,255,255,255,255); ObjEffect_SetVertexColor(framehighscore,1,255,255,255,255);
	ObjEffect_SetVertexColor(framehighscore,2,255,255,255,255); ObjEffect_SetVertexColor(framehighscore,3,255,255,255,255);
	highscorecounter=highscorecounter~[framehighscore];
}

	framestagebar=(Obj_Create(OBJ_EFFECT));
	Obj_SetPosition(framestagebar,556,270); ObjEffect_SetScale(framestagebar,1,1);
	ObjEffect_SetLayer(framestagebar,8); ObjEffect_SetTexture(framestagebar,GRstagebar); ObjEffect_SetRenderState(framestagebar,ALPHA);
	ObjEffect_SetPrimitiveType(framestagebar,PRIMITIVE_TRIANGLESTRIP); ObjEffect_CreateVertex(framestagebar,4);
	ObjEffect_SetVertexXY(framestagebar,0,-64,-16); ObjEffect_SetVertexUV(framestagebar,0,0,0);
	ObjEffect_SetVertexXY(framestagebar,1,64,-16); ObjEffect_SetVertexUV(framestagebar,1,128,0);
	ObjEffect_SetVertexXY(framestagebar,2,-64,16); ObjEffect_SetVertexUV(framestagebar,2,0,32);
	ObjEffect_SetVertexXY(framestagebar,3,64,16); ObjEffect_SetVertexUV(framestagebar,3,128,32);
	ObjEffect_SetVertexColor(framestagebar,0,255,255,255,255); ObjEffect_SetVertexColor(framestagebar,1,255,255,255,255);
	ObjEffect_SetVertexColor(framestagebar,2,255,255,255,255); ObjEffect_SetVertexColor(framestagebar,3,255,255,255,255);

	framedifficultybar=(Obj_Create(OBJ_EFFECT));
	Obj_SetPosition(framedifficultybar,556,300); ObjEffect_SetScale(framedifficultybar,1,1);
	ObjEffect_SetLayer(framedifficultybar,8); ObjEffect_SetTexture(framedifficultybar,GRdifficultybar); ObjEffect_SetRenderState(framedifficultybar,ALPHA);
	ObjEffect_SetPrimitiveType(framedifficultybar,PRIMITIVE_TRIANGLESTRIP); ObjEffect_CreateVertex(framedifficultybar,4);
	ObjEffect_SetVertexXY(framedifficultybar,0,-64,-16); ObjEffect_SetVertexUV(framedifficultybar,0,0,0);
	ObjEffect_SetVertexXY(framedifficultybar,1,64,-16); ObjEffect_SetVertexUV(framedifficultybar,1,128,0);
	ObjEffect_SetVertexXY(framedifficultybar,2,-64,16); ObjEffect_SetVertexUV(framedifficultybar,2,0,32);
	ObjEffect_SetVertexXY(framedifficultybar,3,64,16); ObjEffect_SetVertexUV(framedifficultybar,3,128,32);
	ObjEffect_SetVertexColor(framedifficultybar,0,255,255,255,255); ObjEffect_SetVertexColor(framedifficultybar,1,255,255,255,255);
	ObjEffect_SetVertexColor(framedifficultybar,2,255,255,255,255); ObjEffect_SetVertexColor(framedifficultybar,3,255,255,255,255);

let xsize=128;
let ysize=128;
	EFpractise1=(Obj_Create(OBJ_EFFECT));
	Obj_SetPosition(EFpractise1,560,380);
	ObjEffect_SetScale(EFpractise1,1,1);
	ObjEffect_SetLayer(EFpractise1,8); ObjEffect_SetTexture(EFpractise1,BGpractise1); ObjEffect_SetRenderState(EFpractise1,ALPHA);
	ObjEffect_SetPrimitiveType(EFpractise1,PRIMITIVE_TRIANGLESTRIP); ObjEffect_CreateVertex(EFpractise1,4);
	ObjEffect_SetVertexXY(EFpractise1,0,-(xsize/2),-(ysize/2)); ObjEffect_SetVertexUV(EFpractise1,0,0,0);
	ObjEffect_SetVertexXY(EFpractise1,1,(xsize/2),-(ysize/2)); ObjEffect_SetVertexUV(EFpractise1,1,xsize,0);
	ObjEffect_SetVertexXY(EFpractise1,2,-xsize/2,ysize/2); ObjEffect_SetVertexUV(EFpractise1,2,0,ysize);
	ObjEffect_SetVertexXY(EFpractise1,3,(xsize/2),ysize/2); ObjEffect_SetVertexUV(EFpractise1,3,xsize,ysize);
	ObjEffect_SetVertexColor(EFpractise1,0,255,255,255,255); ObjEffect_SetVertexColor(EFpractise1,1,255,255,255,255);
	ObjEffect_SetVertexColor(EFpractise1,2,255,255,255,255); ObjEffect_SetVertexColor(EFpractise1,3,255,255,255,255);

	EFpractise2=(Obj_Create(OBJ_EFFECT));
	Obj_SetPosition(EFpractise2,560,380);
	ObjEffect_SetScale(EFpractise2,1,1);
	ObjEffect_SetLayer(EFpractise2,8); ObjEffect_SetTexture(EFpractise2,BGpractise2); ObjEffect_SetRenderState(EFpractise2,ALPHA);
	ObjEffect_SetPrimitiveType(EFpractise2,PRIMITIVE_TRIANGLESTRIP); ObjEffect_CreateVertex(EFpractise2,4);
	ObjEffect_SetVertexXY(EFpractise2,0,-(xsize/2),-(ysize/2)); ObjEffect_SetVertexUV(EFpractise2,0,0,0);
	ObjEffect_SetVertexXY(EFpractise2,1,(xsize/2),-(ysize/2)); ObjEffect_SetVertexUV(EFpractise2,1,xsize,0);
	ObjEffect_SetVertexXY(EFpractise2,2,-xsize/2,ysize/2); ObjEffect_SetVertexUV(EFpractise2,2,0,ysize);
	ObjEffect_SetVertexXY(EFpractise2,3,(xsize/2),ysize/2); ObjEffect_SetVertexUV(EFpractise2,3,xsize,ysize);
	ObjEffect_SetVertexColor(EFpractise2,0,255,255,255,255); ObjEffect_SetVertexColor(EFpractise2,1,255,255,255,255);
	ObjEffect_SetVertexColor(EFpractise2,2,255,255,255,255); ObjEffect_SetVertexColor(EFpractise2,3,255,255,255,255);

	EFcontinued=(Obj_Create(OBJ_EFFECT));
	Obj_SetPosition(EFcontinued,560,380); ObjEffect_SetScale(EFcontinued,0,0);
	ObjEffect_SetLayer(EFcontinued,8); ObjEffect_SetTexture(EFcontinued,GRcontinued);
	ObjEffect_SetPrimitiveType(EFcontinued,PRIMITIVE_TRIANGLESTRIP); ObjEffect_CreateVertex(EFcontinued,4);
	ObjEffect_SetVertexXY(EFcontinued,0,-90,-50); ObjEffect_SetVertexUV(EFcontinued,0,0,0);
	ObjEffect_SetVertexXY(EFcontinued,1,90,-50); ObjEffect_SetVertexUV(EFcontinued,1,180,0);
	ObjEffect_SetVertexXY(EFcontinued,2,-90,50); ObjEffect_SetVertexUV(EFcontinued,2,0,100);
	ObjEffect_SetVertexXY(EFcontinued,3,90,50); ObjEffect_SetVertexUV(EFcontinued,3,180,100);
	ObjEffect_SetVertexColor(EFcontinued,0,255,255,255,255); ObjEffect_SetVertexColor(EFcontinued,1,255,255,255,255);
	ObjEffect_SetVertexColor(EFcontinued,2,255,255,255,255); ObjEffect_SetVertexColor(EFcontinued,3,255,255,255,255);

let xsize=640;
let ysize=480;
	EFblack=(Obj_Create(OBJ_EFFECT));
	Obj_SetPosition(EFblack,320,240);
	ObjEffect_SetScale(EFblack,1,1);
	ObjEffect_SetLayer(EFblack,8); ObjEffect_SetTexture(EFblack,GRblack); ObjEffect_SetRenderState(EFblack,ALPHA);
	ObjEffect_SetPrimitiveType(EFblack,PRIMITIVE_TRIANGLESTRIP); ObjEffect_CreateVertex(EFblack,4);
	ObjEffect_SetVertexXY(EFblack,0,-(xsize/2),-(ysize/2)); ObjEffect_SetVertexUV(EFblack,0,0,0);
	ObjEffect_SetVertexXY(EFblack,1,(xsize/2),-(ysize/2)); ObjEffect_SetVertexUV(EFblack,1,xsize,0);
	ObjEffect_SetVertexXY(EFblack,2,-xsize/2,ysize/2); ObjEffect_SetVertexUV(EFblack,2,0,ysize);
	ObjEffect_SetVertexXY(EFblack,3,(xsize/2),ysize/2); ObjEffect_SetVertexUV(EFblack,3,xsize,ysize);
	ObjEffect_SetVertexColor(EFblack,0,255,0,0,0); ObjEffect_SetVertexColor(EFblack,1,255,0,0,0);
	ObjEffect_SetVertexColor(EFblack,2,255,0,0,0); ObjEffect_SetVertexColor(EFblack,3,255,0,0,0);

guiloaded=true;
}

if(GetCommonDataDefault("InSpellcardPractise",0)==1){ ObjEffect_SetScale(EFpractise1,1,1); }
if(GetCommonDataDefault("InSpellcardPractise",0)==0){ ObjEffect_SetScale(EFpractise1,0,0); }
if(GetCommonDataDefault("InStagePractise",0)>=1){ ObjEffect_SetScale(EFpractise2,1,1); }
if(GetCommonDataDefault("InStagePractise",0)==0){ ObjEffect_SetScale(EFpractise2,0,0); }

//LIVES
let i=0;
let horizontal=0;
if(GetPlayerLife>8){ ExtendPlayer(-1); }
loop(9){
	Obj_SetPosition(lifecounter[i],510+horizontal,136);
	if(GetPlayerLife==0){ Obj_SetPosition(lifecounter[i],700,144); }
	i++;
	if(i<GetPlayerLife){ horizontal+=16; }
}

//BOMBS
let i=0;
let horizontal=0;
if(GetPlayerBomb>8){ AddBomb(-1); }
loop(8){
	Obj_SetPosition(bombcounter[i],512+horizontal,160);
	if(GetPlayerBomb==0){ Obj_SetPosition(bombcounter[i],700,172); }
	i++;
	if(i<GetPlayerBomb){ horizontal+=16; }
}

//POWER
let number=0;
let digit=0;
let i=0;
loop(3){
	let horizontal=0;
	let vertical=0;
	Obj_SetPosition(powercounter[i],508+number,186);
		if(i==2){ digit=floor(GetCommonData("Power"))%10; }
		if(i==1){ digit=floor(GetCommonData("Power")/10)%10; }
		if(i==0){ digit=floor(GetCommonData("Power")/100)%10; }
		loop(digit){
			horizontal+=14;
			if(horizontal>=70){ horizontal=0; vertical+=16; }
		}
	ObjEffect_SetVertexUV(powercounter[i],0,0+horizontal,24+vertical);
	ObjEffect_SetVertexUV(powercounter[i],1,14+horizontal,24+vertical);
	ObjEffect_SetVertexUV(powercounter[i],2,0+horizontal,40+vertical);
	ObjEffect_SetVertexUV(powercounter[i],3,14+horizontal,40+vertical);
	i++;
	number+=12;
}

//MAX POWER
let number=0;
let digit=0;
let i=0;
loop(3){
	let horizontal=0;
	let vertical=0;
	Obj_SetPosition(maxpowercounter[i],556+number,186);
		if(i==2){ digit=floor(GetCommonData("MaxPower"))%10; }
		if(i==1){ digit=floor(GetCommonData("MaxPower")/10)%10; }
		if(i==0){ digit=floor(GetCommonData("MaxPower")/100)%10; }
		loop(digit){
			horizontal+=14;
			if(horizontal>=70){ horizontal=0; vertical+=16; }
		}
	ObjEffect_SetVertexUV(maxpowercounter[i],0,0+horizontal,24+vertical);
	ObjEffect_SetVertexUV(maxpowercounter[i],1,14+horizontal,24+vertical);
	ObjEffect_SetVertexUV(maxpowercounter[i],2,0+horizontal,40+vertical);
	ObjEffect_SetVertexUV(maxpowercounter[i],3,14+horizontal,40+vertical);
	i++;
	number+=12;
}

//POINTS
let number=0;
let digit=0;
let i=0;
loop(4){
	let horizontal=0;
	let vertical=0;
	Obj_SetPosition(pointcounter[i],508+number,210);
		if(i==3){ digit=floor(GetCommonData("Points"))%10; }
		if(i==2){ digit=floor(GetCommonData("Points")/10)%10; }
		if(i==1){ digit=floor(GetCommonData("Points")/100)%10; }
		if(i==0){ digit=floor(GetCommonData("Points")/1000)%10; }
		loop(digit){
			horizontal+=14;
			if(horizontal>=70){ horizontal=0; vertical+=16; }
		}
	ObjEffect_SetVertexUV(pointcounter[i],0,0+horizontal,24+vertical);
	ObjEffect_SetVertexUV(pointcounter[i],1,14+horizontal,24+vertical);
	ObjEffect_SetVertexUV(pointcounter[i],2,0+horizontal,40+vertical);
	ObjEffect_SetVertexUV(pointcounter[i],3,14+horizontal,40+vertical);
	i++;
	number+=12;
}

//MAX POINTS
let number=0;
let digit=0;
let i=0;
loop(4){
	let horizontal=0;
	let vertical=0;
	Obj_SetPosition(maxpointcounter[i],568+number,210);
		if(i==3){ digit=floor(GetCommonData("MaxPoints"))%10; }
		if(i==2){ digit=floor(GetCommonData("MaxPoints")/10)%10; }
		if(i==1){ digit=floor(GetCommonData("MaxPoints")/100)%10; }
		if(i==0){ digit=floor(GetCommonData("MaxPoints")/1000)%10; }
		loop(digit){
			horizontal+=14;
			if(horizontal>=70){ horizontal=0; vertical+=16; }
		}
	ObjEffect_SetVertexUV(maxpointcounter[i],0,0+horizontal,24+vertical);
	ObjEffect_SetVertexUV(maxpointcounter[i],1,14+horizontal,24+vertical);
	ObjEffect_SetVertexUV(maxpointcounter[i],2,0+horizontal,40+vertical);
	ObjEffect_SetVertexUV(maxpointcounter[i],3,14+horizontal,40+vertical);
	i++;
	number+=12;
}

//GRAZE
let number=0;
let digit=0;
let i=0;
loop(4){
	let horizontal=0;
	let vertical=0;
	Obj_SetPosition(grazecounter[i],508+number,233);
		if(i==3){ digit=floor(GetGraze)%10; }
		if(i==2){ digit=floor(GetGraze/10)%10; }
		if(i==1){ digit=floor(GetGraze/100)%10; }
		if(i==0){ digit=floor(GetGraze/1000)%10; }
		loop(digit){
			horizontal+=14;
			if(horizontal>=70){ horizontal=0; vertical+=16; }
		}
	ObjEffect_SetVertexUV(grazecounter[i],0,0+horizontal,24+vertical);
	ObjEffect_SetVertexUV(grazecounter[i],1,14+horizontal,24+vertical);
	ObjEffect_SetVertexUV(grazecounter[i],2,0+horizontal,40+vertical);
	ObjEffect_SetVertexUV(grazecounter[i],3,14+horizontal,40+vertical);
	i++;
	number+=12;
}

//SCORE
let number=0;
let digit=0;
let i=0;
loop(12){
	let horizontal=0;
	let vertical=0;
	Obj_SetPosition(scorecounter[i],464+number,100);
		if(i==11){ digit=floor(GetScore)%10; }
		if(i==10){ digit=floor(GetScore/10)%10; }
		if(i==9){ digit=floor(GetScore/100)%10; }
		if(i==8){ digit=floor(GetScore/1000)%10; }
		if(i==7){ digit=floor(GetScore/10000)%10; }
		if(i==6){ digit=floor(GetScore/100000)%10; }
		if(i==5){ digit=floor(GetScore/1000000)%10; }
		if(i==4){ digit=floor(GetScore/10000000)%10; }
		if(i==3){ digit=floor(GetScore/100000000)%10; }
		if(i==2){ digit=floor(GetScore/1000000000)%10; }
		if(i==1){ digit=floor(GetScore/10000000000)%10; }
		if(i==0){ digit=floor(GetScore/100000000000)%10; }
		loop(digit){
			horizontal+=14;
			if(horizontal>=70){ horizontal=0; vertical+=16; }
		}
	ObjEffect_SetVertexUV(scorecounter[i],0,0+horizontal,24+vertical);
	ObjEffect_SetVertexUV(scorecounter[i],1,14+horizontal,24+vertical);
	ObjEffect_SetVertexUV(scorecounter[i],2,0+horizontal,40+vertical);
	ObjEffect_SetVertexUV(scorecounter[i],3,14+horizontal,40+vertical);
	i++;
	number+=12;
}

//HIGHSCORE
let score=0;
if(GetCommonData("Difficulty")==1 && stage>=1 && stage<=6){ score=GetCommonData("HighScoreEasy")[stage]; }
if(GetCommonData("Difficulty")==2 && stage>=1 && stage<=6){ score=GetCommonData("HighScoreNormal")[stage]; }
if(GetCommonData("Difficulty")==3 && stage>=1 && stage<=6){ score=GetCommonData("HighScoreHard")[stage]; }
if(GetCommonData("Difficulty")==4 && stage>=1 && stage<=6){ score=GetCommonData("HighScoreLunatic")[stage]; }
if(stage==7){ score=GetCommonData("HighScoreExtra"); }
if(stage==8){ score=GetCommonData("HighScoreNightmare"); }
if(stage==0){
let i=0;
	loop(18){
	score+=GetCommonData("HighScoreTrumpCards")[i];
	i++;
	}
}
let number=0;
let digit=0;
let i=0;
loop(12){
	let horizontal=0;
	let vertical=0;
	Obj_SetPosition(highscorecounter[i],464+number,44);
		if(i==11){ digit=floor(score)%10; }
		if(i==10){ digit=floor(score/10)%10; }
		if(i==9){ digit=floor(score/100)%10; }
		if(i==8){ digit=floor(score/1000)%10; }
		if(i==7){ digit=floor(score/10000)%10; }
		if(i==6){ digit=floor(score/100000)%10; }
		if(i==5){ digit=floor(score/1000000)%10; }
		if(i==4){ digit=floor(score/10000000)%10; }
		if(i==3){ digit=floor(score/100000000)%10; }
		if(i==2){ digit=floor(score/1000000000)%10; }
		if(i==1){ digit=floor(score/10000000000)%10; }
		if(i==0){ digit=floor(score/100000000000)%10; }
		loop(digit){
			horizontal+=14;
			if(horizontal>=70){ horizontal=0; vertical+=16; }
		}
	ObjEffect_SetVertexUV(highscorecounter[i],0,0+horizontal,24+vertical);
	ObjEffect_SetVertexUV(highscorecounter[i],1,14+horizontal,24+vertical);
	ObjEffect_SetVertexUV(highscorecounter[i],2,0+horizontal,40+vertical);
	ObjEffect_SetVertexUV(highscorecounter[i],3,14+horizontal,40+vertical);
	i++;
	number+=12;
}


//STAGE BAR
let stagepos=(GetCommonData("Stage")-1)*32;
if(GetCommonData("Stage")<1){ ObjEffect_SetScale(framestagebar,0,0); }
if(GetCommonData("Stage")>=1 && GetCommonData("Stage")<=8){ ObjEffect_SetScale(framestagebar,1,1); }
	ObjEffect_SetVertexUV(framestagebar,0,0,0+stagepos);
	ObjEffect_SetVertexUV(framestagebar,1,128,0+stagepos);
	ObjEffect_SetVertexUV(framestagebar,2,0,32+stagepos);
	ObjEffect_SetVertexUV(framestagebar,3,128,32+stagepos);

//DIFFICULTY BAR
let difficultypos=(GetCommonData("Difficulty")-1)*32;
if(GetCommonData("Stage")<1){ ObjEffect_SetScale(framedifficultybar,0,0); }
if(GetCommonData("Stage")>=1 && GetCommonData("Stage")<=6){ ObjEffect_SetScale(framedifficultybar,1,1); }
	ObjEffect_SetVertexUV(framedifficultybar,0,0,0+difficultypos);
	ObjEffect_SetVertexUV(framedifficultybar,1,128,0+difficultypos);
	ObjEffect_SetVertexUV(framedifficultybar,2,0,32+difficultypos);
	ObjEffect_SetVertexUV(framedifficultybar,3,128,32+difficultypos);

//CONTINUED
if(Continued==true && GetCommonDataDefault("InStagePractise",0)==0 && GetCommonDataDefault("InSpellcardPractise",0)==0){ ObjEffect_SetScale(EFcontinued,1,1); }	
if(Continued==false){ ObjEffect_SetScale(EFcontinued,0,0); }	


//IN EVENT

if(GetCommonData("InEvent")==0){
	ForbidShot(false);
	ForbidBomb(false);
	SetCommonData("ItemCollect",0);
}

if(GetCommonData("InEvent")==1){
	ForbidShot(true);
	ForbidBomb(true);
	SetCommonData("ItemCollect",1);
}


//POWERBAR

if(GetCommonData("PlayerType")==1){ maxpower=150; }
if(GetCommonData("PlayerType")==2){ maxpower=150; }
if(GetCommonData("PlayerType")==3){ maxpower=150; }
if(GetCommonData("PlayerType")==4){ maxpower=150; }
if(GetCommonData("PlayerType")==5){ maxpower=150; }
SetCommonData("MaxPower",maxpower);

if(GetCommonData("Power")>GetCommonData("MaxPower")){ SetCommonData("Power",GetCommonData("MaxPower")); }
powerx=GetCommonData("Power");

ObjEffect_SetVertexXY(EFpowerbar2,0,-50,80-(155*powerx/maxpower));
ObjEffect_SetVertexXY(EFpowerbar2,1,50,80-(155*powerx/maxpower));

//colorR=255; colorG=255; colorB=255;


if(GetCommonData("PlayerType")==1){
	if(GetCommonData("InEvent")==0 && GetCommonData("Stage")>0){
	if(powerx>=30 && poweredup==0){ if(GetCommonData("DrainPower")==0){ PlaySE(SEpowerup); } poweredup=1; } if(powerx<30 && poweredup==1){ poweredup=0; }
	if(powerx>=60 && poweredup==1){ if(GetCommonData("DrainPower")==0){ PlaySE(SEpowerup); } poweredup=2; } if(powerx<60 && poweredup==2){ poweredup=1; }
	if(powerx>=90 && poweredup==2){ if(GetCommonData("DrainPower")==0){ PlaySE(SEpowerup); } poweredup=3; } if(powerx<90 && poweredup==3){ poweredup=2; }
	if(powerx>=120 && poweredup==3){ if(GetCommonData("DrainPower")==0){ PlaySE(SEpowerup); } poweredup=4; } if(powerx<120 && poweredup==4){ poweredup=3; }
	if(powerx>=150 && poweredup==4){ if(GetCommonData("DrainPower")==0){ PlaySE(SEpowerup); } poweredup=5; } if(powerx<150 && poweredup==5){ poweredup=4; }
	} // >stage 0
	if(powerx<30){ colorR=255; colorG=0; colorB=0; }
	if(powerx>=30 && powerx<60){ colorR=255; colorG=64; colorB=0; }
	if(powerx>=60 && powerx<90){ colorR=255; colorG=128; colorB=0; }
	if(powerx>=90 && powerx<120){ colorR=255; colorG=192; colorB=0; }
	if(powerx>=120 && powerx<150){ colorR=200; colorG=255; colorB=0; }
	if(powerx>=150){ colorR=0; colorG=255; colorB=0; }
}

if(GetCommonData("PlayerType")==5){
	if(GetCommonData("InEvent")==0 && GetCommonData("Stage")>0){
	if(powerx>=25 && poweredup==0){ if(GetCommonData("DrainPower")==0){ PlaySE(SEpowerup); } poweredup=1; } if(powerx<25 && poweredup==1){ poweredup=0; }
	if(powerx>=50 && poweredup==1){ if(GetCommonData("DrainPower")==0){ PlaySE(SEpowerup); } poweredup=2; } if(powerx<50 && poweredup==2){ poweredup=1; }
	if(powerx>=75 && poweredup==2){ if(GetCommonData("DrainPower")==0){ PlaySE(SEpowerup); } poweredup=3; } if(powerx<75 && poweredup==3){ poweredup=2; }
	if(powerx>=100 && poweredup==3){ if(GetCommonData("DrainPower")==0){ PlaySE(SEpowerup); } poweredup=4; } if(powerx<100 && poweredup==4){ poweredup=3; }
	if(powerx>=125 && poweredup==4){ if(GetCommonData("DrainPower")==0){ PlaySE(SEpowerup); } poweredup=5; } if(powerx<125 && poweredup==5){ poweredup=4; }
	if(powerx>=150 && poweredup==5){ if(GetCommonData("DrainPower")==0){ PlaySE(SEpowerup); } poweredup=6; } if(powerx<150 && poweredup==6){ poweredup=5; }

	} // >stage 0
	if(powerx<25){ colorR=255; colorG=0; colorB=0; }
	if(powerx>=25 && powerx<50){ colorR=255; colorG=51; colorB=0; }
	if(powerx>=50 && powerx<75){ colorR=255; colorG=102; colorB=0; }
	if(powerx>=75 && powerx<100){ colorR=255; colorG=153; colorB=0; }
	if(powerx>=100 && powerx<125){ colorR=255; colorG=204; colorB=0; }
	if(powerx>=125 && powerx<150){ colorR=200; colorG=255; colorB=0; }
	if(powerx>=150){ colorR=0; colorG=255; colorB=0; }
}

if(GetCommonData("PlayerType")==4){
	if(GetCommonData("InEvent")==0 && GetCommonData("Stage")>0){
	if(powerx>=70 && poweredup==0){ if(GetCommonData("DrainPower")==0){ PlaySE(SEpowerup); } poweredup=1; } if(powerx<70 && poweredup==1){ poweredup=0; }
	if(powerx>=110 && poweredup==1){ if(GetCommonData("DrainPower")==0){ PlaySE(SEpowerup); } poweredup=2; } if(powerx<110 && poweredup==2){ poweredup=1; }
	if(powerx>=150 && poweredup==2){ if(GetCommonData("DrainPower")==0){ PlaySE(SEpowerup); } poweredup=3; } if(powerx<140 && poweredup==3){ poweredup=2; }
	} // >stage 0
	if(powerx<70){ colorR=255; colorG=0; colorB=0; }
	if(powerx>=70 && powerx<110){ colorR=255; colorG=170; colorB=0; }
	if(powerx>=110 && powerx<150){ colorR=255; colorG=255; colorB=0; }
	if(powerx>=150){ colorR=0; colorG=255; colorB=0; }
}

if(GetCommonData("PlayerType")==3){
	if(GetCommonData("InEvent")==0 && GetCommonData("Stage")>0){
	if(powerx>=45 && poweredup==0){ if(GetCommonData("DrainPower")==0){ PlaySE(SEpowerup); } poweredup=1; } if(powerx<45 && poweredup==1){ poweredup=0; }
	if(powerx>=80 && poweredup==1){ if(GetCommonData("DrainPower")==0){ PlaySE(SEpowerup); } poweredup=2; } if(powerx<80 && poweredup==2){ poweredup=1; }
	if(powerx>=115 && poweredup==2){ if(GetCommonData("DrainPower")==0){ PlaySE(SEpowerup); } poweredup=3; } if(powerx<115 && poweredup==3){ poweredup=2; }
	if(powerx>=150 && poweredup==3){ if(GetCommonData("DrainPower")==0){ PlaySE(SEpowerup); } poweredup=4; } if(powerx<150 && poweredup==4){ poweredup=3; }
	} // >stage 0
	if(powerx<45){ colorR=255; colorG=0; colorB=0; }
	if(powerx>=45 && powerx<80){ colorR=255; colorG=85; colorB=0; }
	if(powerx>=80 && powerx<115){ colorR=255; colorG=170; colorB=0; }
	if(powerx>=115 && powerx<150){ colorR=255; colorG=255; colorB=0; }
	if(powerx>=150){ colorR=0; colorG=255; colorB=0; }
}

if(GetCommonData("PlayerType")==2){
	if(GetCommonData("InEvent")==0 && GetCommonData("Stage")>0){
		if(powerx>=60 && poweredup==0){ if(GetCommonData("DrainPower")==0){ PlaySE(SEpowerup); } poweredup=1; } if(powerx<60 && poweredup==1){ poweredup=0; }
		if(powerx>=105 && poweredup==1){ if(GetCommonData("DrainPower")==0){ PlaySE(SEpowerup); } poweredup=2; } if(powerx<105 && poweredup==2){ poweredup=1; }
		if(powerx>=150 && poweredup==2){ if(GetCommonData("DrainPower")==0){ PlaySE(SEpowerup); } poweredup=3; } if(powerx<150 && poweredup==3){ poweredup=2; }
	} // >stage 0
	if(powerx<60){ colorR=255; colorG=0; colorB=0; }
	if(powerx>=60 && powerx<105){ colorR=255; colorG=105; colorB=0; }
	if(powerx>=105 && powerx<150){ colorR=255; colorG=210; colorB=0; }
	if(powerx>=150){ colorR=0; colorG=255; colorB=0; }
}


ObjEffect_SetVertexColor(EFpowerbar2,0,255,colorR,colorG,colorB); ObjEffect_SetVertexColor(EFpowerbar2,1,255,colorR,colorG,colorB);
ObjEffect_SetVertexColor(EFpowerbar2,2,255,colorR,colorG,colorB); ObjEffect_SetVertexColor(EFpowerbar2,3,255,colorR,colorG,colorB);


if(OnPlayerMissed==true && GetCommonData("PlayerType")==5 && deathtime==0){ SetCommonData("DrainPower",5); }
if(OnPlayerMissed==true && GetCommonData("PlayerType")!=5 && deathtime==0){ SetCommonData("DrainPower",10); }
if(OnPlayerMissed==true){ deathtime++; }
if((OnPlayerMissed==true && time%3==0 && GetCommonData("DrainPower")>0) || (OnPlayerMissed==false && time%3==0 && GetCommonData("DrainPower")>0)){
	if(GetCommonData("Power")>0){
	SetCommonData("Power",GetCommonData("Power")-1);
	SetCommonData("DrainPower",GetCommonData("DrainPower")-1);
	}
	if(GetCommonData("Power")<=0){
	SetCommonData("DrainPower",0);
	}
}
if(OnPlayerMissed==false){ deathtime=0; }


//POINTS

let oldlife=10;

if(GetCommonData("Stage")<7){
	if(points==0){ SetCommonData("MaxPoints",300); }
	if(GetCommonData("Points")>=GetCommonData("MaxPoints") && points==0){ if(time>0){ oldlife=GetPlayerLife; ExtendPlayer(1); } points=1; }
	if(points==1){ SetCommonData("MaxPoints",600); }
	if(GetCommonData("Points")>=GetCommonData("MaxPoints") && points==1){ if(time>0){ oldlife=GetPlayerLife; ExtendPlayer(1); } points=2; }
	if(points==2){ SetCommonData("MaxPoints",900); }
	if(GetCommonData("Points")>=GetCommonData("MaxPoints") && points==2){ if(time>0){ oldlife=GetPlayerLife; ExtendPlayer(1); } points=3; }
	if(points==3){ SetCommonData("MaxPoints",1200); }
	if(GetCommonData("Points")>=GetCommonData("MaxPoints") && points==3){ if(time>0){ oldlife=GetPlayerLife; ExtendPlayer(1); } points=4; }
	if(points==4){ SetCommonData("MaxPoints",1500); }
	if(GetCommonData("Points")>=GetCommonData("MaxPoints") && points==4){ if(time>0){ oldlife=GetPlayerLife; ExtendPlayer(1); } points=5; }
	if(points==5){ SetCommonData("MaxPoints",1800); }
	if(GetCommonData("Points")>=GetCommonData("MaxPoints") && points==5){ if(time>0){ oldlife=GetPlayerLife; ExtendPlayer(1); } points=6; }
	if(points==6){ SetCommonData("MaxPoints",9999); }
}

if(GetCommonData("Stage")>=7){
	if(points==0){ SetCommonData("MaxPoints",250); }
	if(GetCommonData("Points")>=GetCommonData("MaxPoints") && points==0){ if(time>0){ oldlife=GetPlayerLife; ExtendPlayer(1); } points=1; }
	if(points==1){ SetCommonData("MaxPoints",500); }
	if(GetCommonData("Points")>=GetCommonData("MaxPoints") && points==1){ if(time>0){ oldlife=GetPlayerLife; ExtendPlayer(1); } points=2; }
	if(points==2){ SetCommonData("MaxPoints",750); }
	if(GetCommonData("Points")>=GetCommonData("MaxPoints") && points==2){ if(time>0){ oldlife=GetPlayerLife; ExtendPlayer(1); } points=3; }
	if(points==3){ SetCommonData("MaxPoints",1000); }
	if(GetCommonData("Points")>=GetCommonData("MaxPoints") && points==3){ if(time>0){ oldlife=GetPlayerLife; ExtendPlayer(1); } points=4; }
	if(points==4){ SetCommonData("MaxPoints",9999); }
}

if(GetPlayerLife>oldlife){ PlaySE(SEextralife); oldlife=GetPlayerLife; }


//BOSS MOVER

if(GetCommonData("Boss1Vanish")==1){
	BossMove1(false,GRempty,1,0,0,cx,cy,0); 
	SetCommonData("Boss1Vanish",0);
}
if(GetCommonData("Boss2Vanish")==1){
	BossMove2(false,GRempty,1,0,0,cx,cy,0); 
	SetCommonData("Boss2Vanish",0);
}

function BossMove1(visible,graphic,outfit,startposx,startposy,newposx,newposy,movetime){
	moved1=false;
	accel1=0;
	movecounter1=0;
	movetime1=movetime;
	ObjEffect_SetTexture(boss1,graphic);
	outfit1=outfit;
	if(visible==true){ ObjEffect_SetScale(boss1,1,1); }
	if(visible==false){ ObjEffect_SetScale(boss1,0,0); }
	if(startposx!=0 && startposy!=0){ Obj_SetPosition(boss1,startposx,startposy); }
	else{ startposx=GetCommonData("Boss1X"); startposy=GetCommonData("Boss1Y"); }
	Obj_SetAngle(boss1,atan2(newposy-startposy,newposx-startposx));
	radius1=(((newposx-startposx)^2+(newposy-startposy)^2)^0.5)/movetime1*(pi/2);
}

if(movecounter1<movetime1 && moved1==false){
	accel1+=180/movetime1;
	if(Obj_GetAngle(boss1)>=90 || Obj_GetAngle(boss1)<-90){ boss1ani=144; }
	if(Obj_GetAngle(boss1)<90 && Obj_GetAngle(boss1)>=-90){ boss1ani=288; }
	Obj_SetSpeed(boss1,radius1*sin(accel1));
	SetCommonData("Boss1X",Obj_GetX(boss1));
	SetCommonData("Boss1Y",Obj_GetY(boss1));
	movecounter1++;
	if(movecounter1>=movetime1){ movecounter1=0; moved1=true; }
}

function BossMove2(visible,graphic,outfit,startposx,startposy,newposx,newposy,movetime){
	moved2=false;
	accel2=0;
	movecounter2=0;
	movetime2=movetime;
	ObjEffect_SetTexture(boss2,graphic);
	outfit2=outfit;
	if(visible==true){ ObjEffect_SetScale(boss2,1,1); }
	if(visible==false){ ObjEffect_SetScale(boss2,0,0); }
	if(startposx!=0 && startposy!=0){ Obj_SetPosition(boss2,startposx,startposy); }
	else{ startposx=GetCommonData("Boss2X"); startposy=GetCommonData("Boss2Y"); }
	Obj_SetAngle(boss2,atan2(newposy-startposy,newposx-startposx));
	radius2=(((newposx-startposx)^2+(newposy-startposy)^2)^0.5)/movetime2*(pi/2);
}

if(movecounter2<movetime2 && moved2==false){
	accel2+=180/movetime2;
	if(Obj_GetAngle(boss2)>=90 || Obj_GetAngle(boss2)<-90){ boss2ani=144; }
	if(Obj_GetAngle(boss2)<90 && Obj_GetAngle(boss2)>=-90){ boss2ani=288; }
	Obj_SetSpeed(boss2,radius2*sin(accel2));
	SetCommonData("Boss2X",Obj_GetX(boss2));
	SetCommonData("Boss2Y",Obj_GetY(boss2));
	movecounter2++;
	if(movecounter2>=movetime2){ movecounter2=0; moved2=true; }
}

	
let outfit1b=(128*outfit1)-128;
ObjEffect_SetVertexUV(boss1,0,0,outfit1b); ObjEffect_SetVertexUV(boss1,1,128,outfit1b);
ObjEffect_SetVertexUV(boss1,2,0,outfit1b+128); ObjEffect_SetVertexUV(boss1,3,128,outfit1b+128);

if(boss1oldx>Obj_GetX(boss1)){
	ObjEffect_SetVertexUV(boss1,0,128,outfit1b); ObjEffect_SetVertexUV(boss1,1,256,outfit1b);
	ObjEffect_SetVertexUV(boss1,2,128,outfit1b+128); ObjEffect_SetVertexUV(boss1,3,256,outfit1b+144);
}
if(boss1oldx<Obj_GetX(boss1)){
	ObjEffect_SetVertexUV(boss1,0,256,outfit1b); ObjEffect_SetVertexUV(boss1,1,384,outfit1b);
	ObjEffect_SetVertexUV(boss1,2,256,outfit1b+128); ObjEffect_SetVertexUV(boss1,3,384,outfit1b+128);
}
boss1oldx=Obj_GetX(boss1);

let outfit2b=(128*outfit2)-128;
ObjEffect_SetVertexUV(boss2,0,0,outfit2b); ObjEffect_SetVertexUV(boss2,1,128,outfit2b);
ObjEffect_SetVertexUV(boss2,2,0,outfit2b+128); ObjEffect_SetVertexUV(boss2,3,128,outfit2b+128);

if(boss2oldx>Obj_GetX(boss2)){
	ObjEffect_SetVertexUV(boss2,0,128,outfit2b); ObjEffect_SetVertexUV(boss2,1,256,outfit2b);
	ObjEffect_SetVertexUV(boss2,2,128,outfit2b+128); ObjEffect_SetVertexUV(boss2,3,256,outfit2b+144);
}
if(boss2oldx<Obj_GetX(boss2)){
	ObjEffect_SetVertexUV(boss2,0,256,outfit2b); ObjEffect_SetVertexUV(boss2,1,384,outfit2b);
	ObjEffect_SetVertexUV(boss2,2,256,outfit2b+128); ObjEffect_SetVertexUV(boss2,3,384,outfit2b+128);
}
boss2oldx=Obj_GetX(boss2);


//BACKGROUND CAMERA MOVEMENT

if(viewmovetimexy!=0){
	viewanglexy=atan2(newviewy-viewy,newviewx-viewx);
	viewradiusxy=(((newviewx-viewx)^2+(newviewy-viewy)^2)^0.5)/viewmovetimexy*(pi/2);
	viewmaxtimexy=viewmovetimexy; viewmovetimexy=0;
	viewcounterxy=0; viewaccelxy=0;
}
if(viewcounterxy<viewmaxtimexy){
	viewaccelxy+=180/viewmaxtimexy;
	viewspeedxy=viewradiusxy*sin(viewaccelxy);
	viewx+=viewspeedxy*cos(viewanglexy);
	viewy+=viewspeedxy*sin(viewanglexy);
	viewcounterxy++;
}

if(viewmovetimehv!=0){
	viewanglehv=atan2(newviewv-viewv,newviewh-viewh);
	viewradiushv=(((newviewh-viewh)^2+(newviewv-viewv)^2)^0.5)/viewmovetimehv*(pi/2);
	viewmaxtimehv=viewmovetimehv; viewmovetimehv=0;
	viewcounterhv=0; viewaccelhv=0;
}
if(viewcounterhv<viewmaxtimehv){
	viewaccelhv+=180/viewmaxtimehv;
	viewspeedhv=viewradiushv*sin(viewaccelhv);
	viewh+=viewspeedhv*cos(viewanglehv);
	viewv+=viewspeedhv*sin(viewanglehv);
	viewcounterhv++;
}

//QUIT STAGE PRACTISE

if(GetCommonData("InStagePractise")==2 && GetKeyState(VK_USER)==KEY_HOLD){ quittimer++; }
if(GetCommonData("InStagePractise")==2 && GetKeyState(VK_USER)==KEY_FREE){ quittimer=0; }
if(GetCommonData("InStagePractise")==2 && GetKeyState(VK_USER)==KEY_HOLD && quittimer>=60){ Retry; }
if(GetCommonData("InStagePractise")==3){ SaveCommonData; Retry; }
