#TouhouDanmakufu[Plural]
#ScriptVersion[3]
#Title["Togekiss Battle - Hard"]
#Text["For hardcore Touhou players"] 
#Player["./Lef Players/Sakuya Izayoi/Player_Sakuya.txt","./Lef Players/Reimu Hakurei/Player_Reimu.txt","./Lef Players/Marisa Kirisame/Player_Marisa.txt"]

#include "./functions.txt"


let background = GetCurrentScriptDirectory ~ "images/a3.png";

@Event{
}

@Initialize{
    TPlural;
	renderBG;
}

@MainLoop{
    yield;
}

task TPlural{
    let dir = GetCurrentScriptDirectory();
    let obj = ObjEnemyBossScene_Create();
    ObjEnemyBossScene_Add(obj, 0, dir ~ "./ns1H.txt");
    ObjEnemyBossScene_Add(obj, 0, dir ~ "./s4H.txt");
    ObjEnemyBossScene_Add(obj, 1, dir ~ "./ns2H.txt");
    ObjEnemyBossScene_Add(obj, 1, dir ~ "./s2H.txt");
    ObjEnemyBossScene_Add(obj, 2, dir ~ "./ns3H.txt");
    ObjEnemyBossScene_Add(obj, 2, dir ~ "./s1H.txt");
	ObjEnemyBossScene_Add(obj, 3, dir ~ "./ns4H.txt");
	ObjEnemyBossScene_Add(obj, 3, dir ~ "./s3H.txt");
	ObjEnemyBossScene_Add(obj, 4, dir ~ "./ns5H.txt");
	ObjEnemyBossScene_Add(obj, 4, dir ~ "./s5H.txt");
	ObjEnemyBossScene_Add(obj, 5, dir ~ "./ns6H.txt");
	ObjEnemyBossScene_Add(obj, 5, dir ~ "./s6H.txt");
	ObjEnemyBossScene_Add(obj, 6, dir ~ "./s7H.txt");
    ObjEnemyBossScene_LoadInThread(obj);
    ObjEnemyBossScene_Regist(obj);
    while(!Obj_IsDeleted(obj)){
        yield;
    }
	wait(120);
    CloseScript(GetOwnScriptID());
}

//BACKGROUND
task renderBG {
	let BGobj = ObjPrim_Create(OBJ_SPRITE_2D);
	ObjPrim_SetTexture(BGobj,background);
	ObjSprite2D_SetSourceRect(BGobj,0,0,800,480);
	ObjSprite2D_SetDestRect(BGobj,0,0,GetStgFrameWidth,GetStgFrameHeight);
	Obj_SetRenderPriorityI(BGobj,20);
	ObjSprite2D_SetDestCenter(BGobj); 
	let count = 0;
	loop {
		count+=0.1;
		ObjRender_SetPosition(BGobj,GetStgFrameWidth/2+205*cos(count),GetStgFrameHeight/2+10*sin(count),0);
		yield;
		if (count == 720) {count = 0;  }
	}

	/*let obj = ObjPrim_Create(OBJ_SPRITE_2D);
	Obj_SetRenderPriorityI(obj,21); 
	ObjPrim_SetTexture(obj,firepit); 
	ObjSprite2D_SetSourceRect(obj,0,0,400,400);
	ObjSprite2D_SetDestRect(obj,0,0,GetStgFrameWidth,GetStgFrameHeight);
	
*/
}