#TouhouDanmakufu[Stage]
#Title[10D Style Mima - Boss Battle (All Effects)]
#Text[By Shockman
If you can play this, then good job on finding a good computer/laptop.]
#Player[FREE]
#ScriptVersion[2]

script_stage_main{

let SP = GetCurrentScriptDirectory~"Enemy\Hard\sp\sp.png";
   let m = -1400;
   let n = -700;
   let o = 0;
   let acc1 = 10;
   let acc2 = 0;
   let acc3 = 0;
   let acc4 = 0;
   let acc5 = 0;
   let acc6 = 0;
   let blos = 0;
   let fogc = 20;
   let displaysettings = 0;
   let l = 0;
   let f2 = 0;
   let f3 = 0;
   let f4 = 0;
   let f5 = 0;
   let f6 = 0;
   let f7 = 0;
   let f = 0;
   let statcheck = 0;
   let obj;
   let count = 60;
   let stageintro = GetCurrentScriptDirectory~"intro\st01logo.png";
   let nbg = GetCurrentScriptDirectory ~ "ef\nbg1.png";
   let nbg2 = GetCurrentScriptDirectory ~ "ef\nbg3.png";
   let nbg3 = GetCurrentScriptDirectory ~ "ef\nbg4.png";
   let nbg4 = GetCurrentScriptDirectory ~ "ef\nbg5.png";
   let nbg5 = GetCurrentScriptDirectory ~ "ef\nbg2.png";
   let nbg6 = GetCurrentScriptDirectory ~ "ef\nbg6.png";
   let title = GetCurrentScriptDirectory ~ "ef\stg1txt.png";
   let ex = GetCurrentScriptDirectory ~ "ef\EXTRA.png";
   let ST = GetCurrentScriptDirectory ~ "mu\bgm.mp3";
   let BO  = GetCurrentScriptDirectory ~ "Boss\mu\bgm2.mp3";
   let depth_buffer_enable = false;

   let timer2 = 50;
   let timer3 = 61;
	

 function Wait(let frames){
   loop(frames*2){yield;}
 }
 function WaitForZeroEnemy{
  while(GetEnemyNum != 0){yield;}
 }



 task stage{
	DeleteSE("se\seEnemyExplode01.wav");
	DeleteSE("se\seUseSpellCard.wav");
Wait(80);
CreateEnemyBossFromFile(GetCurrentScriptDirectory~"Boss\PLURAL.txt", 0, 0, 0, 0, 0);
  WaitForZeroEnemy;
Wait(200);
  Clear;
 }



  @Initialize{
	
      LoadGraphic(nbg);
      LoadGraphic(nbg2);
      LoadGraphic(nbg3);
      LoadGraphic(nbg4);
      LoadGraphic(nbg5);
      LoadGraphic(nbg6);
      LoadGraphic(ex);
      LoadGraphic(SP);
      LoadGraphic(title);
      LoadGraphic(frame);
      LoadGraphic(nametag);
      LoadGraphic(diffi);
      LoadGraphic(sb);
      LoadGraphic(sh);
      LoadGraphic(imgNumber);
      LoadGraphic(imgNumber2);
      LoadGraphic(imgNumber3);
      LoadGraphic(imgNumber4);
LoadMusic(ST);
PlayMusic(ST);
LoadMusic(BO);
 stage;
  }
 @MainLoop{
		blos++;
		if(blos%10==0 && OnEnemySpell==false && displaysettings == 6){
			blossom(rand(GetClipMinX,GetClipMaxX),GetClipMinY-20,rand(0.1,0.6));
		}
      m += 5;
      n += 5;
      o += 1;
f += 0.5;
timer2 -= 2;
if (o == 60){
timer2 = 60;
o = 0;
}
yield;
  }
  @BackGround{
if (f4 == 0){
DisplayScore;
DisplayHighScore;
DisplayGraze;
DisplayPoint;
 stgframe;
 sbomb;
 slife;
 diff;
}
if (statcheck == 2){
sbomb;
slife;
statcheck = 0;

}
if (f4 == 100){
DisplayTimer;
enametag;
}
SetDefaultStatusVisible(false);
SetRateScoreSystemEnable(false);
acc2 += 0.1;
      WriteZBuffer(depth_buffer_enable);
      UseZBuffer(depth_buffer_enable);
      

      SetViewTo(0, -200, 80);
      SetViewFrom(10, -90, 20);  
      SetFog ( 50, 750, 40+fogc, 15+fogc, 50+fogc); 

      SetAlpha(255);
      SetTexture(nbg5);
      SetGraphicRect(0, 0, 512, 512);

      SetGraphicAngle(0, 0, 0);
      SetGraphicScale(1,1);
      DrawGraphic(GetCenterX, GetCenterY);   

      SetAlpha(255);
      SetRenderState(ALPHA);
      SetTexture(nbg);
      SetGraphicRect(0, -350+f+acc2, 800, 500+f+acc2);
      SetGraphicAngle(90, 0, 0);
      SetGraphicScale(1,1);
      DrawGraphic3D(0, -300, 600);

      SetAlpha(255);
      SetRenderState(ALPHA);
      SetTexture(nbg3);
      SetGraphicRect(0, -350+f+acc2, 256, 500+f+acc2);
      SetGraphicAngle(90, 0, 0);
      SetGraphicScale(0.7,1);
      DrawGraphic3D(0, -300, 600);
acc4 = 0;
acc6 = 0;

if (acc1 > 0){
acc1 -= 0.01;
}
if (acc3 < 100){
acc3 += 0.1;
}

acc4 += 1;
f2 += 4;
f3++;
f4++;
f5 += 0.4;
statcheck++;
   yield;
}
  @Finalize{
      DeleteGraphic(nbg);
      DeleteGraphic(nbg2);
      DeleteGraphic(nbg3);
      DeleteGraphic(ex);
      DeleteGraphic(SP);
      DeleteGraphic(frame);
      DeleteGraphic(nametag);
      DeleteGraphic(frame);
DeleteMusic(ST);
DeleteMusic(BO);
}



//Status


   let frame  = GetCurrentScriptDirectory ~ "ef\Frame.png";
   let nametag  = GetCurrentScriptDirectory ~ "ef\nametag.png";
   let diffi  = GetCurrentScriptDirectory ~ "ef\Evil.png";
   let sb  = GetCurrentScriptDirectory ~ "ef\STATUS\BOMB.png";
   let sh  = GetCurrentScriptDirectory ~ "ef\STATUS\LIFE.png";
   let imgNumber  = GetCurrentScriptDirectory ~ "ef\STATUS\NUMBER.png";
   let imgNumber2  = GetCurrentScriptDirectory ~ "ef\STATUS\GNUMBER.png";
   let imgNumber3  = GetCurrentScriptDirectory ~ "ef\STATUS\PNUMBER.png";
   let imgNumber4  = GetCurrentScriptDirectory ~ "ef\STATUS\TNUMBER.png";


	task stgframe{
let obj=Obj_Create(OBJ_EFFECT);
Obj_SetX(obj,0);
Obj_SetY(obj,0);
ObjEffect_SetLayer(obj,8);
ObjEffect_SetRenderState(obj,ALPHA);
ObjEffect_SetTexture(obj,frame);
ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLEFAN);
ObjEffect_SetScale(obj,1,1);
ObjEffect_SetAngle(obj,0,0,0);
ObjEffect_CreateVertex(obj,4);
ObjEffect_SetVertexUV(obj,0,0,0);
ObjEffect_SetVertexUV(obj,1,640,0);
ObjEffect_SetVertexUV(obj,2,640,480);
ObjEffect_SetVertexUV(obj,3,0,480);
ObjEffect_SetVertexXY(obj,0,0,0);
ObjEffect_SetVertexXY(obj,1,640,0);
ObjEffect_SetVertexXY(obj,2,640,480);
ObjEffect_SetVertexXY(obj,3,0,480);
yield;
	}
	task enametag{
let obj=Obj_Create(OBJ_EFFECT);
Obj_SetX(obj,35);
Obj_SetY(obj,GetClipMinY-3);
ObjEffect_SetLayer(obj,8);
ObjEffect_SetRenderState(obj,ALPHA);
ObjEffect_SetTexture(obj,nametag);
ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLEFAN);
ObjEffect_SetScale(obj,1,1);
ObjEffect_SetAngle(obj,0,0,0);
ObjEffect_CreateVertex(obj,4);
ObjEffect_SetVertexUV(obj,0,0,0);
ObjEffect_SetVertexUV(obj,1,32,0);
ObjEffect_SetVertexUV(obj,2,32,15);
ObjEffect_SetVertexUV(obj,3,0,15);
ObjEffect_SetVertexXY(obj,0,0,0);
ObjEffect_SetVertexXY(obj,1,32,0);
ObjEffect_SetVertexXY(obj,2,32,15);
ObjEffect_SetVertexXY(obj,3,0,15);
yield;
	}
	task diff{
let obj=Obj_Create(OBJ_EFFECT);
Obj_SetX(obj,506);
Obj_SetY(obj,24);
ObjEffect_SetLayer(obj,8);
ObjEffect_SetRenderState(obj,ALPHA);
ObjEffect_SetTexture(obj,diffi);
ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLEFAN);
ObjEffect_SetScale(obj,1,1);
ObjEffect_SetAngle(obj,0,0,0);
ObjEffect_CreateVertex(obj,4);
ObjEffect_SetVertexUV(obj,0,0,0);
ObjEffect_SetVertexUV(obj,1,49,0);
ObjEffect_SetVertexUV(obj,2,49,16);
ObjEffect_SetVertexUV(obj,3,0,16);
ObjEffect_SetVertexXY(obj,0,0,0);
ObjEffect_SetVertexXY(obj,1,49,0);
ObjEffect_SetVertexXY(obj,2,49,16);
ObjEffect_SetVertexXY(obj,3,0,16);
yield;
	}






	task sbomb{
let nu = 0;
loop(GetPlayerBomb){
let obj=Obj_Create(OBJ_EFFECT);
Obj_SetX(obj,514+nu);
Obj_SetY(obj,139);
ObjEffect_SetLayer(obj,8);
ObjEffect_SetRenderState(obj,ALPHA);
ObjEffect_SetTexture(obj,sb);
ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLEFAN);
ObjEffect_SetScale(obj,1,1);
ObjEffect_SetAngle(obj,0,0,0);
ObjEffect_CreateVertex(obj,4);
ObjEffect_SetVertexUV(obj,0,0,0);
ObjEffect_SetVertexUV(obj,1,16,0);
ObjEffect_SetVertexUV(obj,2,16,15);
ObjEffect_SetVertexUV(obj,3,0,15);
ObjEffect_SetVertexXY(obj,0,0,0);
ObjEffect_SetVertexXY(obj,1,16,0);
ObjEffect_SetVertexXY(obj,2,16,15);
ObjEffect_SetVertexXY(obj,3,0,15);
nu += 13;
Wait(2);
Obj_Delete(obj);
}
yield;
	}
	task slife{
let nu = 0;
loop(GetPlayerLife-1){
let obj=Obj_Create(OBJ_EFFECT);
Obj_SetX(obj,514+nu);
Obj_SetY(obj,101);
ObjEffect_SetLayer(obj,8);
ObjEffect_SetRenderState(obj,ALPHA);
ObjEffect_SetTexture(obj,sh);
ObjEffect_SetPrimitiveType(obj,PRIMITIVE_TRIANGLEFAN);
ObjEffect_SetScale(obj,1,1);
ObjEffect_SetAngle(obj,0,0,0);
ObjEffect_CreateVertex(obj,4);
ObjEffect_SetVertexUV(obj,0,0,0);
ObjEffect_SetVertexUV(obj,1,16,0);
ObjEffect_SetVertexUV(obj,2,16,15);
ObjEffect_SetVertexUV(obj,3,0,15);
ObjEffect_SetVertexXY(obj,0,0,0);
ObjEffect_SetVertexXY(obj,1,16,0);
ObjEffect_SetVertexXY(obj,2,16,15);
ObjEffect_SetVertexXY(obj,3,0,15);
nu += 13;
Wait(2);
Obj_Delete(obj);
}
yield;
	}

function FormatNumberString(number, digits){
    // number is the number you want to format, and digits is the number of digits you want to display
    // In the case of the example score counter I'm building right now, I'd use FunctionNumberString(GetScore, 10);
    let str = ToString(number);
    loop(7){
        str = erase(str, length(str)-1); // Erase the last 7 characters of the string because those are the decimals and the decimal point.
    }
    while(length(str) < digits){
        str = "." ~ str; // If the string is shorter than the amount of digits wanted, add some 0s in the beginning.
    }
    while(length(str) > digits){
        str = erase(str, length(str)-1); // If the string is longer than the amount of digits wanted, remove the digits on the end until it fits. This is how ZUN actually handles this.
    }
    return str;
}

function FormatNumberString2(number, digits){
    // number is the number you want to format, and digits is the number of digits you want to display
    // In the case of the example score counter I'm building right now, I'd use FunctionNumberString(GetScore, 10);
    let str = ToString(number);
    loop(7){
        str = erase(str, length(str)-1); // Erase the last 7 characters of the string because those are the decimals and the decimal point.
    }
    while(length(str) < digits){
        str = "." ~ str; // If the string is shorter than the amount of digits wanted, add some 0s in the beginning.
    }
    while(length(str) > digits){
        str = erase(str, length(str)-1); // If the string is longer than the amount of digits wanted, remove the digits on the end until it fits. This is how ZUN actually handles this.
    }
    return str;
}

function FormatNumberString3(number, digits){
    // number is the number you want to format, and digits is the number of digits you want to display
    // In the case of the example score counter I'm building right now, I'd use FunctionNumberString(GetScore, 10);
    let str = ToString(number);
    loop(7){
        str = erase(str, length(str)-1); // Erase the last 7 characters of the string because those are the decimals and the decimal point.
    }
    while(length(str) < digits){
        str = "/" ~ str; // If the string is shorter than the amount of digits wanted, add some 0s in the beginning.
    }
    while(length(str) > digits){
        str = erase(str, length(str)-1); // If the string is longer than the amount of digits wanted, remove the digits on the end until it fits. This is how ZUN actually handles this.
    }
    return str;
}

function FormatNumberString4(number, digits){
    // number is the number you want to format, and digits is the number of digits you want to display
    // In the case of the example score counter I'm building right now, I'd use FunctionNumberString(GetScore, 10);
    let str = ToString(number);
    loop(7){
        str = erase(str, length(str)-1); // Erase the last 7 characters of the string because those are the decimals and the decimal point.
    }
    while(length(str) < digits){
        str = "0" ~ str; // If the string is shorter than the amount of digits wanted, add some 0s in the beginning.
    }
    while(length(str) > digits){
        str = erase(str, length(str)-1); // If the string is longer than the amount of digits wanted, remove the digits on the end until it fits. This is how ZUN actually handles this.
    }
    return str;
}

task DisplayScore {
    yield; // Yielding in the beginning because you can't create effect objects in @Initialize, yet I was expecting this task to be called in there.
    let digits = [];
    loop(10){
        digits = digits ~ [Obj_Create(OBJ_EFFECT)]; // Yes, this is allowed. :V
    }
    ascent(i in 0..10){
        let obj = digits[i];
        Obj_SetPosition(obj, GetClipMaxX+80+12*i, GetClipMinY+59); // I don't know if this is a good position or not. Fiddle around with it for a bit.

        ObjEffect_SetTexture(obj, imgNumber); // Make sure imgNumber is actually defined and that you loaded it.
        ObjEffect_SetLayer(obj, 8); // The rest of this is copied from your post.
        ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
        ObjEffect_CreateVertex(obj, 4);
        ObjEffect_SetVertexXY(obj, 0, -8, -8);
        ObjEffect_SetVertexXY(obj, 1, 8, -8);
        ObjEffect_SetVertexXY(obj, 2, 8, 8);
        ObjEffect_SetVertexXY(obj, 3, -8, 8);
    }

    loop {
        let score = FormatNumberString(GetScore, 10); // The function I just wrote earlier.
        ascent(i in 0..10){
            let obj = digits[i];
            let number = score[i]-48; // I'm exploiting a strange quirk of Danmakufu here. I'll explain it after this code block. All you need to know for now is that I'm changing the character into a number.
            let offset = number*16;
            ObjEffect_SetVertexUV(obj, 0, 0+offset, 0);   // Add the offset to the x value of all the vertices.
            ObjEffect_SetVertexUV(obj, 1, 16+offset, 0); // It wasn't necessary to add it to the y values as you did in the code in your post.
            ObjEffect_SetVertexUV(obj, 2, 16+offset, 16);
            ObjEffect_SetVertexUV(obj, 3, 0+offset, 16);
        }
        yield; // Don't forget the yield in @MainLoop either!
    }
}
task DisplayHighScore {
    yield; // Yielding in the beginning because you can't create effect objects in @Initialize, yet I was expecting this task to be called in there.
    let digits = [];
    loop(10){
        digits = digits ~ [Obj_Create(OBJ_EFFECT)]; // Yes, this is allowed. :V
    }
    ascent(i in 0..10){
        let obj = digits[i];
        Obj_SetPosition(obj, GetClipMaxX+80+12*i, GetClipMinY+37); // I don't know if this is a good position or not. Fiddle around with it for a bit.

        ObjEffect_SetTexture(obj, imgNumber2); // Make sure imgNumber is actually defined and that you loaded it.
        ObjEffect_SetLayer(obj, 8); // The rest of this is copied from your post.
        ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
        ObjEffect_CreateVertex(obj, 4);
        ObjEffect_SetVertexXY(obj, 0, -8, -8);
        ObjEffect_SetVertexXY(obj, 1, 8, -8);
        ObjEffect_SetVertexXY(obj, 2, 8, 8);
        ObjEffect_SetVertexXY(obj, 3, -8, 8);
    }

    loop {
        let score = FormatNumberString(GetScore, 10); // The function I just wrote earlier.
        ascent(i in 0..10){
            let obj = digits[i];
            let number = score[i]-48; // I'm exploiting a strange quirk of Danmakufu here. I'll explain it after this code block. All you need to know for now is that I'm changing the character into a number.
            let offset = number*16;
            ObjEffect_SetVertexUV(obj, 0, 0+offset, 0);   // Add the offset to the x value of all the vertices.
            ObjEffect_SetVertexUV(obj, 1, 16+offset, 0); // It wasn't necessary to add it to the y values as you did in the code in your post.
            ObjEffect_SetVertexUV(obj, 2, 16+offset, 16);
            ObjEffect_SetVertexUV(obj, 3, 0+offset, 16);
        }
        yield; // Don't forget the yield in @MainLoop either!
    }
}
task DisplayGraze {
    yield; // Yielding in the beginning because you can't create effect objects in @Initialize, yet I was expecting this task to be called in there.
    let digits = [];
    loop(10){
        digits = digits ~ [Obj_Create(OBJ_EFFECT)]; // Yes, this is allowed. :V
    }
    ascent(i in 3..10){
        let obj = digits[i];
        Obj_SetPosition(obj, GetClipMaxX+80+12*i, GetClipMinY+253); // I don't know if this is a good position or not. Fiddle around with it for a bit.

        ObjEffect_SetTexture(obj, imgNumber2); // Make sure imgNumber is actually defined and that you loaded it.
        ObjEffect_SetLayer(obj, 8); // The rest of this is copied from your post.
        ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
        ObjEffect_CreateVertex(obj, 4);
        ObjEffect_SetVertexXY(obj, 0, -8, -8);
        ObjEffect_SetVertexXY(obj, 1, 8, -8);
        ObjEffect_SetVertexXY(obj, 2, 8, 8);
        ObjEffect_SetVertexXY(obj, 3, -8, 8);
    }

    loop {
        let score = FormatNumberString2(GetGraze, 10); // The function I just wrote earlier.
        ascent(i in 0..10){
            let obj = digits[i];
            let number = score[i]-48; // I'm exploiting a strange quirk of Danmakufu here. I'll explain it after this code block. All you need to know for now is that I'm changing the character into a number.
            let offset = number*16;
            ObjEffect_SetVertexUV(obj, 0, 0+offset, 0);   // Add the offset to the x value of all the vertices.
            ObjEffect_SetVertexUV(obj, 1, 16+offset, 0); // It wasn't necessary to add it to the y values as you did in the code in your post.
            ObjEffect_SetVertexUV(obj, 2, 16+offset, 16);
            ObjEffect_SetVertexUV(obj, 3, 0+offset, 16);
        }
        yield; // Don't forget the yield in @MainLoop either!
    }
}
task DisplayPoint {
    yield; // Yielding in the beginning because you can't create effect objects in @Initialize, yet I was expecting this task to be called in there.
    let digits = [];
    loop(10){
        digits = digits ~ [Obj_Create(OBJ_EFFECT)]; // Yes, this is allowed. :V
    }
    ascent(i in 3..10){
        let obj = digits[i];
        Obj_SetPosition(obj, GetClipMaxX+80+12*i, GetClipMinY+231); // I don't know if this is a good position or not. Fiddle around with it for a bit.

        ObjEffect_SetTexture(obj, imgNumber3); // Make sure imgNumber is actually defined and that you loaded it.
        ObjEffect_SetLayer(obj, 8); // The rest of this is copied from your post.
        ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
        ObjEffect_CreateVertex(obj, 4);
        ObjEffect_SetVertexXY(obj, 0, -8, -8);
        ObjEffect_SetVertexXY(obj, 1, 8, -8);
        ObjEffect_SetVertexXY(obj, 2, 8, 8);
        ObjEffect_SetVertexXY(obj, 3, -8, 8);
    }

    loop {
        let score = FormatNumberString2(GetPoint, 10); // The function I just wrote earlier.
        ascent(i in 0..10){
            let obj = digits[i];
            let number = score[i]-48; // I'm exploiting a strange quirk of Danmakufu here. I'll explain it after this code block. All you need to know for now is that I'm changing the character into a number.
            let offset = number*16;
            ObjEffect_SetVertexUV(obj, 0, 0+offset, 0);   // Add the offset to the x value of all the vertices.
            ObjEffect_SetVertexUV(obj, 1, 16+offset, 0); // It wasn't necessary to add it to the y values as you did in the code in your post.
            ObjEffect_SetVertexUV(obj, 2, 16+offset, 16);
            ObjEffect_SetVertexUV(obj, 3, 0+offset, 16);
        }
        yield; // Don't forget the yield in @MainLoop either!
    }
}















task DisplayTimer {
    yield; // Yielding in the beginning because you can't create effect objects in @Initialize, yet I was expecting this task to be called in there.
    let digits = [];
    loop(10){
        digits = digits ~ [Obj_Create(OBJ_EFFECT)]; // Yes, this is allowed. :V
    }
    ascent(i in 8..10){
        let obj = digits[i];
        Obj_SetPosition(obj, GetCenterX-100+12*i, GetClipMinY+6); // I don't know if this is a good position or not. Fiddle around with it for a bit.

        ObjEffect_SetTexture(obj, imgNumber4); // Make sure imgNumber is actually defined and that you loaded it.
        ObjEffect_SetLayer(obj, 8); // The rest of this is copied from your post.
        ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
        ObjEffect_CreateVertex(obj, 4);
        ObjEffect_SetVertexXY(obj, 0, -8, -8);
        ObjEffect_SetVertexXY(obj, 1, 8, -8);
        ObjEffect_SetVertexXY(obj, 2, 8, 8);
        ObjEffect_SetVertexXY(obj, 3, -8, 8);

    }

    loop {
        let score = FormatNumberString4(GetTimer, 10); // The function I just wrote earlier.
        ascent(i in 0..10){
            let obj = digits[i];
            let number = score[i]-48; // I'm exploiting a strange quirk of Danmakufu here. I'll explain it after this code block. All you need to know for now is that I'm changing the character into a number.
            let offset = number*16;
            ObjEffect_SetVertexUV(obj, 0, 0+offset, 0);   // Add the offset to the x value of all the vertices.
            ObjEffect_SetVertexUV(obj, 1, 16+offset, 0); // It wasn't necessary to add it to the y values as you did in the code in your post.
            ObjEffect_SetVertexUV(obj, 2, 16+offset, 16);
            ObjEffect_SetVertexUV(obj, 3, 0+offset, 16);
if (GetTimer <= 9){
ObjEffect_SetVertexColor(obj, 0, 255, 255, 0, 0);
ObjEffect_SetVertexColor(obj, 1, 255, 255, 0, 0);
ObjEffect_SetVertexColor(obj, 2, 255, 255, 0, 0);
ObjEffect_SetVertexColor(obj, 3, 255, 255, 0, 0);
}
if (GetTimer > 9){
ObjEffect_SetVertexColor(obj, 0, 255, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 1, 255, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 2, 255, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 3, 255, 255, 255, 255);
}
        }
        yield; // Don't forget the yield in @MainLoop either!
    }
}
task DisplayTimer2 {
    yield; // Yielding in the beginning because you can't create effect objects in @Initialize, yet I was expecting this task to be called in there.
    let digits = [];
    loop(10){
        digits = digits ~ [Obj_Create(OBJ_EFFECT)]; // Yes, this is allowed. :V
    }
    ascent(i in 7..8){
        let obj = digits[i];
        Obj_SetPosition(obj, GetCenterX-110+36+12*i, GetClipMinY+7); // I don't know if this is a good position or not. Fiddle around with it for a bit.

        ObjEffect_SetTexture(obj, imgNumber4); // Make sure imgNumber is actually defined and that you loaded it.
        ObjEffect_SetLayer(obj, 8); // The rest of this is copied from your post.
        ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
        ObjEffect_CreateVertex(obj, 4);
        ObjEffect_SetVertexXY(obj, 0, -8, -8);
        ObjEffect_SetVertexXY(obj, 1, 8, -8);
        ObjEffect_SetVertexXY(obj, 2, 8, 8);
        ObjEffect_SetVertexXY(obj, 3, -8, 8);

    }

    loop {
        let score = FormatNumberString3(GetTimer, 10); // The function I just wrote earlier.
        ascent(i in 0..10){
            let obj = digits[i];
            let number = score[i]-48; // I'm exploiting a strange quirk of Danmakufu here. I'll explain it after this code block. All you need to know for now is that I'm changing the character into a number.
            let offset = number*16;
            ObjEffect_SetVertexUV(obj, 0, 0+offset, 0);   // Add the offset to the x value of all the vertices.
            ObjEffect_SetVertexUV(obj, 1, 16+offset, 0); // It wasn't necessary to add it to the y values as you did in the code in your post.
            ObjEffect_SetVertexUV(obj, 2, 16+offset, 16);
            ObjEffect_SetVertexUV(obj, 3, 0+offset, 16);
if (GetTimer <= 9){
ObjEffect_SetVertexColor(obj, 0, 255, 255, 0, 0);
ObjEffect_SetVertexColor(obj, 1, 255, 255, 0, 0);
ObjEffect_SetVertexColor(obj, 2, 255, 255, 0, 0);
ObjEffect_SetVertexColor(obj, 3, 255, 255, 0, 0);
}
if (GetTimer > 9){
ObjEffect_SetVertexColor(obj, 0, 255, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 1, 255, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 2, 255, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 3, 255, 255, 255, 255);
}
        }
        yield; // Don't forget the yield in @MainLoop either!
    }
}
task DisplayTimer3 {
    yield; // Yielding in the beginning because you can't create effect objects in @Initialize, yet I was expecting this task to be called in there.
    let digits = [];
    loop(10){
        digits = digits ~ [Obj_Create(OBJ_EFFECT)]; // Yes, this is allowed. :V
    }
    ascent(i in 8..10){
        let obj = digits[i];
        Obj_SetPosition(obj, GetCenterX-110+69+7*i, GetClipMinY+10); // I don't know if this is a good position or not. Fiddle around with it for a bit.

        ObjEffect_SetTexture(obj, imgNumber4); // Make sure imgNumber is actually defined and that you loaded it.
        ObjEffect_SetLayer(obj, 8); // The rest of this is copied from your post.
        ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLEFAN);
        ObjEffect_SetScale(obj, 0.7, 0.7);
        ObjEffect_CreateVertex(obj, 4);
        ObjEffect_SetVertexXY(obj, 0, -8, -8);
        ObjEffect_SetVertexXY(obj, 1, 8, -8);
        ObjEffect_SetVertexXY(obj, 2, 8, 8);
        ObjEffect_SetVertexXY(obj, 3, -8, 8);

    }

    loop {
        let score = FormatNumberString4(timer2, 10); // The function I just wrote earlier.
        ascent(i in 0..10){
            let obj = digits[i];
            let number = score[i]-48; // I'm exploiting a strange quirk of Danmakufu here. I'll explain it after this code block. All you need to know for now is that I'm changing the character into a number.
            let offset = number*16;
            ObjEffect_SetVertexUV(obj, 0, 0+offset, 0);   // Add the offset to the x value of all the vertices.
            ObjEffect_SetVertexUV(obj, 1, 16+offset, 0); // It wasn't necessary to add it to the y values as you did in the code in your post.
            ObjEffect_SetVertexUV(obj, 2, 16+offset, 16);
            ObjEffect_SetVertexUV(obj, 3, 0+offset, 16);
if (GetTimer <= 9){
ObjEffect_SetVertexColor(obj, 0, 255, 255, 0, 0);
ObjEffect_SetVertexColor(obj, 1, 255, 255, 0, 0);
ObjEffect_SetVertexColor(obj, 2, 255, 255, 0, 0);
ObjEffect_SetVertexColor(obj, 3, 255, 255, 0, 0);
}
if (GetTimer > 9){
ObjEffect_SetVertexColor(obj, 0, 255, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 1, 255, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 2, 255, 255, 255, 255);
ObjEffect_SetVertexColor(obj, 3, 255, 255, 255, 255);
}
        }
        yield; // Don't forget the yield in @MainLoop either!
    }
}
   task blossom(x,y,scale){
	let particles = GetCurrentScriptDirectory~"\ef\eff0.png";
	LoadGraphic(particles);
	let obj = Obj_Create(OBJ_EFFECT);
	let alp = 255;
	let tr=0;
	let num1;
	let num2;
	let color1=rand_int(100,200);
	let color2=rand_int(80,10);
	let color3=rand_int(80,180);
	let y2=0;
	let yr=rand(1,2);
	let xr=rand(-0.9,0.9);
	let an=rand(1,3);
	let r=rand(1.5,3);
	ObjEffect_SetRenderState(obj,ADD);
	ObjEffect_SetTexture(obj,particles);
	ObjEffect_SetScale(obj,scale,scale);	
	ObjEffect_SetLayer(obj,1);
	ObjEffect_SetPrimitiveType(obj, PRIMITIVE_TRIANGLESTRIP);
	ObjEffect_CreateVertex(obj, 4);
	Obj_SetPosition(obj,x,y-y2);
	while(! Obj_BeDeleted(obj)) {
		Obj_SetPosition(obj,x,y+y2/r);
		x+=xr;
		ObjEffect_SetVertexXY(obj, 0, -16, -16);
		ObjEffect_SetVertexXY(obj, 1, 16, -16);
		ObjEffect_SetVertexXY(obj, 2, -16, 16);
		ObjEffect_SetVertexXY(obj, 3, 16, 16);

		
		ObjEffect_SetVertexUV(obj, 0, 0,0);
		ObjEffect_SetVertexUV(obj, 1, 0, 32);
		ObjEffect_SetVertexUV(obj, 2, 32, 0);
		ObjEffect_SetVertexUV(obj, 3, 32, 32);
		ascent(i in 0..4){ObjEffect_SetVertexColor(obj,i,alp,color1-tr,color2-tr,color3);}
		tr-=2;
		y2+=yr;
		an++;
		ObjEffect_SetAngle(obj,an,an,an);
		ObjEffect_SetScale(obj,scale,scale);
		alp-=0.1;
		if(alp<=0){alp=0;}
		if(tr<0){tr=0;} 
		if(Obj_GetY(obj)>=GetClipMaxY+20){Obj_Delete(obj);}
		yield;
	}

    }





}