let CSD = GetCurrentScriptDirectory;

let bigexplode =  CSD~"music/se_bigexplode.wav";
let ngumpulin =  CSD~"music/se_ch00.wav";
let ngumpulin2 =  CSD~"music/se_ch01.wav";
let charge =  CSD~"music/se_chargeup.wav";
let flames =  CSD~"music/se_don00.wav";
let laser =  CSD~"music/se_lazer00.wav";
let uwadegeng =  CSD~"music/se_power0.wav";
let slurp =  CSD~"music/se_power1.wav";
let cus3 =  CSD~"music/se_tan02.wav";
let cus2 =  CSD~"music/se_tan00.wav";
let cus =  CSD~"music/se_tan01.wav";
let cusbanyak =  CSD~"music/se_tan03.wav";
let tung =  CSD~"music/se_timeout.wav";
let kira =  CSD~"music/se_kira00.wav";

let lga =  CSD~"music/LGA.ogg";
let operation =  CSD~"music/Operation.ogg";

let flame1 =  CSD~"img/flame1.png";
let flame2 =  CSD~"img/flame2.png";
let flame3 =  CSD~"img/flame3.png";
let flame4 =  CSD~"img/flame4.png";
let flame5 =  CSD~"img/flame5.png";
let flame6 =  CSD~"img/flame6.png";
let flame7 =  CSD~"img/flame7.png";
let flame8 =  CSD~"img/flame8.png";
let sfell =  CSD~"img/sfell.png";


task SE_Play(let path, let vl)
{
let seobj = ObjSound_Create;
ObjSound_Load(seobj,path);
ObjSound_Play(seobj);
ObjSound_SetVolumeRate(seobj,vl);
loop(120){yield;}
RemoveSound(path);
}

task BottomEnemyMarker(objB, objBoss)
{
  let imgnumber = GetCurrentScriptDirectory~"img/enemymarker.png";
  let objMarker = ObjPrim_Create(OBJ_SPRITE_2D);
  ObjRender_SetPosition(objMarker, GetStgFrameWidth/2, GetStgFrameHeight+32, 1); 
  ObjPrim_SetPrimitiveType(objMarker, PRIMITIVE_TRIANGLESTRIP);
  ObjRender_SetBlendType(objMarker, BLEND_ALPHA);
  Obj_SetRenderPriority(objMarker, 0.85);
  ObjPrim_SetTexture(objMarker, imgnumber);
  ObjRender_SetAlpha(objMarker, 150);
  ObjSprite2D_SetSourceRect(objMarker, 0, 0, 48, 16);
  ObjSprite2D_SetDestRect(objMarker, -25, -8, 25, 8);
  while(ObjEnemy_GetInfo(objBoss,INFO_LIFE)>0 && ObjMove_GetY(objBoss)>-5)
  {
    ObjRender_SetPosition(objMarker, ObjMove_GetX(objB)+32, GetStgFrameHeight+24, 1);
    yield;
  }
  Obj_Delete(objMarker);
}

task BossName(name,posx){
let objname = ObjText_Create();
ObjText_SetText(objname,name);
ObjText_SetFontType(objname,"RussellSquare");
ObjText_SetFontSize(objname,17);
ObjText_SetFontColorTop(objname,200,30,30);
ObjText_SetFontColorBottom(objname,200,150,150);
		ObjText_SetFontBorderType(objname,BORDER_SHADOW);
		ObjText_SetFontBorderColor(objname,32,32,32);
		ObjText_SetFontBorderWidth(objname,1);
		ObjText_SetHorizontalAlignment(objname, ALIGNMENT_RIGHT);
		ObjText_SetMaxWidth(objname,ClipMaxX);
		Obj_SetRenderPriority(objname,0.8);
		ObjRender_SetPosition(objname,posx, 16, 0);
		ObjRender_SetAlpha(objname, 255);
}

function ClipMinX{
return 0;
}

function ClipMaxX{
return GetStgFrameWidth;
}

function GetCenterX(){
	return GetStgFrameWidth() / 2;
    }
	
function GetCenterY(){
	return GetStgFrameHeight() / 2;
    }
	
function wait(n){
	loop(n){yield;}
    }