script_enemy_main {
	
	let frame = 0;
	let frame2 = 0;
	let CSD = GetCurrentScriptDirectory;
	let x = 0;
	let dir = 0;
	let f = 0;
	let f2 = 0;
	

	@Initialize{
		LoadUserShotData(CSD ~ "ZUN's shotdata.txt");
		SetLife(6000);
		SetDamageRate(0,0);
		mainTask;
	}
	@MainLoop{		
		yield;
	}
	@DrawLoop{
		yield;
	}
	@Finalize{
		yield;
	}
	
	task mainTask{		
		fire;
		movement;
		wait(140);
		VanishEnemy;
		yield;
	}
	
	task movement{
		
		loop{
			SetMovePosition01(GetCenterX-210,GetCenterY-(0.0025*frame*frame),3.5);
			frame++;	
			yield;
		}
	}
	
	task fire{
						
		loop{
			PlaySE(CSD ~ "sfx\se_tan00_2.wav");
			invincible(GetX,GetY,0,25,23,0);
			wait(1);			
		}
		yield;
	}
	
	//object bullet task
	task invincible(x,y,v,dir,graphic,delay){
			let obj = Obj_Create(OBJ_SHOT);
			
			Obj_SetPosition(obj,x,y);
			Obj_SetSpeed(obj,v);
			Obj_SetAngle(obj,dir);
			ObjShot_SetGraphic(obj,graphic);
			ObjShot_SetDelay(obj,delay);
			ObjShot_SetBombResist(obj,true);
			yield;
	}
	
	function wait(w){
		loop(w){yield;}
	}
	
}